[PATCH 2/6] fds: Set cloexec on logging pipe reading end

Ian Jackson ijackson at chiark.greenend.org.uk
Mon Sep 22 16:45:09 BST 2014


This way no-one else will inherit it, and if we die the writing end
will generate SIGPIPE.

Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 secnet.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/secnet.c b/secnet.c
index c604d44..3fe3f44 100644
--- a/secnet.c
+++ b/secnet.c
@@ -412,6 +412,7 @@ static void become_daemon(void)
 	    fatal_perror("can't dup2 pipe");
 	if (close(errfds[1]) < 0)
 	    fatal_perror("can't close redundant pipe endpoint");
+	setcloexec(errfds[0]);
 	log_from_fd(errfds[0],"stderr",system_log);
     }
     secnet_pid=getpid();
-- 
1.7.10.4




More information about the sgo-software-discuss mailing list