tests: Fix coverity warning that sock could be negative
authorAndreas Schneider <asn@samba.org>
Mon, 21 Oct 2019 06:59:57 +0000 (08:59 +0200)
committerAndreas Schneider <asn@samba.org>
Mon, 21 Oct 2019 07:00:53 +0000 (09:00 +0200)
CID 263708

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
tests/dns_srv.c

index 94e5c3d935ec66027481e9cfbe8a8b38abc3f310..868dee4e8fb60e76fab255e09700c4b9f56f1e2e 100644 (file)
@@ -633,8 +633,10 @@ int main(int argc, char **argv)
                }
        }
 
-       dns(sock);
-       close(sock);
+       if (sock != -1) {
+               dns(sock);
+               close(sock);
+       }
 
        if (opts.daemon) {
                unlink(opts.pidfile);