diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2016-06-03 11:29:20 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2016-06-03 11:29:20 -0400 |
commit | ec5622351208989620b6563b7890922e28e65e7b (patch) | |
tree | 4ab68b0c920e2b5b0c802cfc6d77d31659dd7afa /src/bin/pg_dump/parallel.c | |
parent | 404429038896d914f38e1ee80d6d6905be0ad261 (diff) |
Suppress -Wunused-result warnings about write(), again.
Adopt the same solution as in commit aa90e148ca70a235, but this time
let's put the ugliness inside the write_stderr() macro, instead of
expecting each call site to deal with it. Back-port that decision
into psql/common.c where I got the macro from in the first place.
Per gripe from Peter Eisentraut.
Diffstat (limited to 'src/bin/pg_dump/parallel.c')
-rw-r--r-- | src/bin/pg_dump/parallel.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/bin/pg_dump/parallel.c b/src/bin/pg_dump/parallel.c index 03bf732f645..51a8eee369d 100644 --- a/src/bin/pg_dump/parallel.c +++ b/src/bin/pg_dump/parallel.c @@ -136,8 +136,18 @@ static volatile DumpSignalInformation signal_info; static CRITICAL_SECTION signal_info_lock; #endif -/* Used from signal handlers, no buffering */ -#define write_stderr(str) write(fileno(stderr), str, strlen(str)) +/* + * Write a simple string to stderr --- must be safe in a signal handler. + * We ignore the write() result since there's not much we could do about it. + * Certain compilers make that harder than it ought to be. + */ +#define write_stderr(str) \ + do { \ + const char *str_ = (str); \ + int rc_; \ + rc_ = write(fileno(stderr), str_, strlen(str_)); \ + (void) rc_; \ + } while (0) #ifdef WIN32 |