1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

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.
This commit is contained in:
Tom Lane
2011-10-18 21:37:51 -04:00
parent c53d3a9ee1
commit aa90e148ca
5 changed files with 59 additions and 19 deletions

View File

@ -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",