Fix possible close of invalid fd if call to socket() returns -1.
authorTim Potter <tpot@samba.org>
Sun, 17 Feb 2008 23:43:46 +0000 (10:43 +1100)
committerJeremy Allison <jra@samba.org>
Thu, 21 Feb 2008 01:58:50 +0000 (17:58 -0800)
source/lib/util_sock.c

index 71d48d60535f272636bf7ce8ad3f30a0c2a208ba..e040f4631a00e827e870dac668eb813ad35769ae 100644 (file)
@@ -1933,7 +1933,8 @@ int create_pipe_sock(const char *socket_dir,
 
 out_close:
        SAFE_FREE(path);
-       close(sock);
+       if (sock != -1)
+               close(sock);
 
 out_umask:
        umask(old_umask);