postgres.git / summary / log / commit / refs

commit    ec14f16014ecc04f41d9c285cb97922550097653
Author:   Andres Freund <andres@anarazel.de>
Date:     Sun Jan 04 13:36:22 2015 +0000

    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.


src/bin/pg_basebackup/receivelog.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/bin/pg_basebackup/receivelog.c b/src/bin/pg_basebackup/receivelog.c index b1e103e6348..e1bd4ad04dd 100644 --- a/src/bin/pg_basebackup/receivelog.c +++ b/src/bin/pg_basebackup/receivelog.c @@ -62,6 +62,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; } [parent: f6cea45029df]