s3/client/clitar.c: always close fd
authorAurelien Aptel <aaptel@suse.com>
Tue, 31 May 2016 13:46:47 +0000 (15:46 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 2 Jun 2016 10:47:26 +0000 (12:47 +0200)
Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jun  2 12:47:26 CEST 2016 on sn-devel-144

source3/client/clitar.c

index 188f65da9f47699f53a0a1b1a88814ac1033729d..5af0924ab8ae4d95996c4e6c8a55ba557a2cd8f8 100644 (file)
@@ -1257,7 +1257,7 @@ static int tar_read_inclusion_file(struct tar *t, const char* filename)
 {
        char *line;
        int err = 0;
-       int fd;
+       int fd = -1;
        TALLOC_CTX *ctx = talloc_new(NULL);
        if (ctx == NULL) {
                return 1;
@@ -1281,9 +1281,10 @@ static int tar_read_inclusion_file(struct tar *t, const char* filename)
                }
        }
 
-       close(fd);
-
 out:
+       if (fd != -1) {
+               close(fd);
+       }
        talloc_free(ctx);
        return err;
 }