summaryrefslogtreecommitdiff
path: root/source3/lib/util_sock.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2008-02-18 10:43:46 +1100
committerJeremy Allison <jra@samba.org>2008-02-20 17:58:50 -0800
commitabf84656593c567e42025eaf6b1961a2294f913b (patch)
tree9aef0833c95c42f81216b73604f946e9bbfd935d /source3/lib/util_sock.c
parentec1576e3462725d7b0108ff02740466ad5ef6277 (diff)
downloadsamba-abf84656593c567e42025eaf6b1961a2294f913b.tar.gz
samba-abf84656593c567e42025eaf6b1961a2294f913b.tar.bz2
samba-abf84656593c567e42025eaf6b1961a2294f913b.zip
Fix possible close of invalid fd if call to socket() returns -1.
(This used to be commit f7d2f692994918037e603ef95dd097b03d2c5456)
Diffstat (limited to 'source3/lib/util_sock.c')
-rw-r--r--source3/lib/util_sock.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/lib/util_sock.c b/source3/lib/util_sock.c
index 71d48d6053..e040f4631a 100644
--- a/source3/lib/util_sock.c
+++ b/source3/lib/util_sock.c
@@ -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);