s3/client/clitar.c: always close fd
[samba.git] / 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;
 }