diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2012-09-05 14:36:51 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2012-09-05 14:36:51 -0400 |
commit | 970212f911728097b44ac231438c5cf4d45b2089 (patch) | |
tree | dc20acdc328df4e27dd68c54e0f801231254d933 | |
parent | 3d975d0fc5d7fd28839e3cf1871a479bfc0bcd28 (diff) | |
download | postgresql-970212f911728097b44ac231438c5cf4d45b2089.tar.gz postgresql-970212f911728097b44ac231438c5cf4d45b2089.zip |
Silence -Wunused-result warning in contrib/pg_upgrade.
This is just neatnik-ism, but since we do it for comparable code in elog.c,
we may as well do it here.
-rw-r--r-- | contrib/pg_upgrade/util.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/pg_upgrade/util.c b/contrib/pg_upgrade/util.c index 2c0dfd65e4e..d879e762fa2 100644 --- a/contrib/pg_upgrade/util.c +++ b/contrib/pg_upgrade/util.c @@ -81,10 +81,18 @@ pg_log(eLogType type, char *fmt,...) /* fopen() on log_opts.internal might have failed, so check it */ if ((type != PG_VERBOSE || log_opts.verbose) && log_opts.internal != NULL) { - fwrite(message, strlen(message), 1, log_opts.internal); + /* + * There's nothing much we can do about it if fwrite fails, but some + * platforms declare fwrite with warn_unused_result. Do a little + * dance with casting to void to shut up the compiler in such cases. + */ + size_t rc; + + rc = fwrite(message, strlen(message), 1, log_opts.internal); /* if we are using OVERWRITE_MESSAGE, add newline to log file */ if (strchr(message, '\r') != NULL) - fwrite("\n", 1, 1, log_opts.internal); + rc = fwrite("\n", 1, 1, log_opts.internal); + (void) rc; fflush(log_opts.internal); } |