Skip to contentSkip to conversation

master - libdaemon: set CLOEXEC on client socket fd

PATCH okozina 1 participant 1 message Feb 2, 2015

lore
Share & tools
lore

okozina

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9dd81df8b25a51c919679b5f1c4e5fea9269972b
Commit:        9dd81df8b25a51c919679b5f1c4e5fea9269972b
Parent:        99c443facce33d2c666b0e043d9e8a6bd1cb40a2
Author:        Ondrej Kozina <[email protected]>
AuthorDate:    Wed Nov 12 09:50:59 2014 +0100
Committer:     Ondrej Kozina <[email protected]>
CommitterDate: Mon Feb 2 10:15:52 2015 +0100

libdaemon: set CLOEXEC on client socket fd

---
 libdaemon/server/daemon-server.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
libdaemon/server/daemon-server.c +3 -0
index a8afcc1..3dffdbb 100644
@@ -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");