Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0398ece

Browse files
committed
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.
1 parent 2c0a485 commit 0398ece

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/bin/pg_basebackup/receivelog.c

+3
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,9 @@ mark_file_as_archived(const char *basedir, const char *fname)
8181
{
8282
fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
8383
progname, tmppath, strerror(errno));
84+
85+
close(fd);
86+
8487
return false;
8588
}
8689

0 commit comments

Comments
 (0)