mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +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:
@ -3,7 +3,7 @@
|
||||
*
|
||||
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.111 2004/01/25 03:07:22 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.112 2004/01/26 22:35:32 tgl Exp $
|
||||
*/
|
||||
#include "postgres_fe.h"
|
||||
#include "command.h"
|
||||
@ -1601,8 +1601,12 @@ do_edit(const char *filename_arg, PQExpBuffer query_buf)
|
||||
remove(fname);
|
||||
error = true;
|
||||
}
|
||||
else
|
||||
fclose(stream);
|
||||
else if (fclose(stream) != 0)
|
||||
{
|
||||
psql_error("%s: %s\n", fname, strerror(errno));
|
||||
remove(fname);
|
||||
error = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user