1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +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

@ -466,9 +466,9 @@ CopySendEndOfRow(CopyState cstate)
#endif
}
(void) fwrite(fe_msgbuf->data, fe_msgbuf->len,
1, cstate->copy_file);
if (ferror(cstate->copy_file))
if (fwrite(fe_msgbuf->data, fe_msgbuf->len, 1,
cstate->copy_file) != 1 ||
ferror(cstate->copy_file))
ereport(ERROR,
(errcode_for_file_access(),
errmsg("could not write to COPY file: %m")));