mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +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:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.215 2004/01/18 02:15:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.216 2004/01/26 22:35:31 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -921,7 +921,14 @@ DoCopy(const CopyStmt *stmt)
|
||||
}
|
||||
|
||||
if (!pipe)
|
||||
FreeFile(copy_file);
|
||||
{
|
||||
/* we assume only the write case could fail here */
|
||||
if (FreeFile(copy_file))
|
||||
ereport(ERROR,
|
||||
(errcode_for_file_access(),
|
||||
errmsg("could not write to file \"%s\": %m",
|
||||
filename)));
|
||||
}
|
||||
else if (IsUnderPostmaster && !is_from)
|
||||
SendCopyEnd(binary);
|
||||
pfree(attribute_buf.data);
|
||||
|
Reference in New Issue
Block a user