1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-25 01:02:05 +03:00

Ensure that close() and fclose() are checked for errors, at least in

cases involving writes.  Per recent discussion about the possibility
of close-time failures on some filesystems.  There is a TODO item for
this, too.
This commit is contained in:
Tom Lane
2004-01-26 22:35:32 +00:00
parent e0707cbae9
commit c77f363384
15 changed files with 155 additions and 56 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.46 2004/01/07 18:56:29 neilc Exp $
* $PostgreSQL: pgsql/src/interfaces/libpq/fe-lobj.c,v 1.47 2004/01/26 22:35:32 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -491,7 +491,7 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename)
}
/*
* read in from the Unix file and write to the inversion file
* read in from the inversion file and write to the Unix file
*/
while ((nbytes = lo_read(conn, lobj, buf, LO_BUFSIZE)) > 0)
{
@ -508,7 +508,14 @@ lo_export(PGconn *conn, Oid lobjId, const char *filename)
}
(void) lo_close(conn, lobj);
(void) close(fd);
if (close(fd))
{
printfPQExpBuffer(&conn->errorMessage,
libpq_gettext("error while writing to file \"%s\"\n"),
filename);
return -1;
}
return 1;
}