summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);