diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-26 22:35:32 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2004-01-26 22:35:32 +0000 |
| commit | c77f363384c3f4a6bbc73f501d2459e94382a30b (patch) | |
| tree | c722b460526c687c1ec9c546aed71b52fbcb3cc4 /src/interfaces/libpq/fe-lobj.c | |
| parent | e0707cbae9cb5360cd044231fda921fffe8095c5 (diff) | |
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.
Diffstat (limited to 'src/interfaces/libpq/fe-lobj.c')
| -rw-r--r-- | src/interfaces/libpq/fe-lobj.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/interfaces/libpq/fe-lobj.c b/src/interfaces/libpq/fe-lobj.c index 822ccfe11d6..16d4970d9eb 100644 --- a/src/interfaces/libpq/fe-lobj.c +++ b/src/interfaces/libpq/fe-lobj.c @@ -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; } |
