From 728ceba938dfadb204a4854bb76ae3b11b635401 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 2 Oct 2016 12:33:46 -0400 Subject: 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 --- src/common/file_utils.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/common/file_utils.c') 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; } -- cgit v1.2.3