s4-socket: use set_close_on_exec()
[bbaumbach/samba-autobuild/.git] / source4 / lib / socket / socket_unix.c
index d492f01268127b5b8879f3f34a31bbc43d6d3f1d..ab9b06df1b9bfee90b8042b3020e430f95822100 100644 (file)
@@ -59,6 +59,8 @@ static NTSTATUS unixdom_init(struct socket_context *sock)
 
        sock->backend_name = "unix";
 
+       set_close_on_exec(sock->fd);
+
        return NT_STATUS_OK;
 }
 
@@ -198,6 +200,8 @@ static NTSTATUS unixdom_accept(struct socket_context *sock,
                }
        }
 
+       set_close_on_exec(new_fd);
+
        (*new_sock) = talloc(NULL, struct socket_context);
        if (!(*new_sock)) {
                close(new_fd);