aboutsummaryrefslogtreecommitdiff
path: root/src/common/file_utils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2016-10-02 12:33:46 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2016-10-02 12:33:46 -0400
commit728ceba938dfadb204a4854bb76ae3b11b635401 (patch)
tree2a161db8a308ad8f2e95abae11b992795b32f000 /src/common/file_utils.c
parent3b90e38c5d592ea8ec8236287dd5c749fc041728 (diff)
downloadpostgresql-728ceba938dfadb204a4854bb76ae3b11b635401.tar.gz
postgresql-728ceba938dfadb204a4854bb76ae3b11b635401.zip
Avoid leaking FDs after an fsync failure.
Fixes errors introduced in commit bc34223bc, as detected by Coverity. In passing, report ENOSPC for a short write while padding a new wal file in open_walfile, make certain that close_walfile closes walfile in all cases, and improve a couple of comments. Michael Paquier and Tom Lane
Diffstat (limited to 'src/common/file_utils.c')
-rw-r--r--src/common/file_utils.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/common/file_utils.c b/src/common/file_utils.c
index 1d855645b91..1855e2372c8 100644
--- a/src/common/file_utils.c
+++ b/src/common/file_utils.c
@@ -273,6 +273,7 @@ fsync_fname(const char *fname, bool isdir, const char *progname)
{
fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
progname, fname, strerror(errno));
+ (void) close(fd);
return -1;
}