summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-01-04 14:36:22 +0100
committerAndres Freund <andres@anarazel.de>2015-01-04 14:36:22 +0100
commitf4060db11852e65c97d956a5b1d860ebb180e767 (patch)
tree9e8877674e6327b44dfae3539fec770a3cbfedc5 /src
parentf961ad4790bddd540ebc5c3b44f752a3869fa866 (diff)
Fix inconsequential fd leak in the new mark_file_as_archived() function.
As every error in mark_file_as_archived() will lead to a failure of pg_basebackup the FD leak couldn't ever lead to a real problem. It seems better to fix the leak anyway though, rather than silence Coverity, as the usage of the function might get extended or copied at some point in the future. Pointed out by Coverity. Backpatch to 9.2, like the relevant part of the previous patch.
Diffstat (limited to 'src')
-rw-r--r--src/bin/pg_basebackup/receivelog.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c
index 9cd0942de3a..b7f43d5aef0 100644
--- a/src/bin/pg_basebackup/receivelog.c
+++ b/src/bin/pg_basebackup/receivelog.c
@@ -65,6 +65,9 @@ mark_file_as_archived(const char *basedir, const char *fname)
{
fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
progname, tmppath, strerror(errno));
+
+ close(fd);
+
return false;
}