From 9dd81df8b25a51c919679b5f1c4e5fea9269972b Mon Sep 17 00:00:00 2001 From: Ondrej Kozina Date: Wed, 12 Nov 2014 09:50:59 +0100 Subject: [PATCH] libdaemon: set CLOEXEC on client socket fd --- libdaemon/server/daemon-server.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c index a8afcc1de..3dffdbb0b 100644 --- a/libdaemon/server/daemon-server.c +++ b/libdaemon/server/daemon-server.c @@ -470,6 +470,9 @@ static int handle_connect(daemon_state s) if (client.socket_fd < 0) return 0; + if (fcntl(client.socket_fd, F_SETFD, FD_CLOEXEC)) + WARN(&s, "setting CLOEXEC on client socket fd %d failed", client.socket_fd); + if (!(ts = dm_malloc(sizeof(thread_state)))) { if (close(client.socket_fd)) perror("close"); -- 2.43.5