]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:lib: Do not close fd = -1 on fail in netapi example
authorAndreas Schneider <asn@samba.org>
Fri, 10 Dec 2021 14:03:20 +0000 (15:03 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 15 Dec 2021 19:32:30 +0000 (19:32 +0000)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/lib/netapi/examples/common.c

index 997144a34e21be44dda59d9b974fcd93d799f518..66b2bd3b6d0b13bd6c9404a11194dab2b62d6b08 100644 (file)
@@ -167,7 +167,9 @@ char *netapi_read_file(const char *filename, uint32_t *psize)
        if (file != NULL) {
                fclose(file);
        }
-       close(fd);
+       if (fd >= 0) {
+               close(fd);
+       }
 
        return p;
 }