From aa90e148ca70a235897b1227f1a7cd1c66bc5368 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 18 Oct 2011 21:37:51 -0400 Subject: Suppress -Wunused-result warnings about write() and fwrite(). This is merely an exercise in satisfying pedants, not a bug fix, because in every case we were checking for failure later with ferror(), or else there was nothing useful to be done about a failure anyway. Document the latter cases. --- src/backend/access/transam/xlog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/backend/access/transam/xlog.c') diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index befb5070477..1c17348472e 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -9067,8 +9067,10 @@ do_pg_start_backup(const char *backupidstr, bool fast, char **labelfile) (errcode_for_file_access(), errmsg("could not create file \"%s\": %m", BACKUP_LABEL_FILE))); - fwrite(labelfbuf.data, labelfbuf.len, 1, fp); - if (fflush(fp) || ferror(fp) || FreeFile(fp)) + if (fwrite(labelfbuf.data, labelfbuf.len, 1, fp) != 1 || + fflush(fp) != 0 || + ferror(fp) || + FreeFile(fp)) ereport(ERROR, (errcode_for_file_access(), errmsg("could not write file \"%s\": %m", -- cgit v1.2.3