summaryrefslogtreecommitdiff
path: root/src/emacs.c
diff options
context:
space:
mode:
authorDan Nicolaescu <dann@ics.uci.edu>2008-12-08 16:22:40 +0000
committerDan Nicolaescu <dann@ics.uci.edu>2008-12-08 16:22:40 +0000
commit7c19d3aedbc55c4458bd8911aaa614c0c7f2c316 (patch)
tree6f943a7ab287d8f863e40a84b9ed141b522635e6 /src/emacs.c
parentd31eee5eccaab4f86222be76ddb383bf9db2188c (diff)
downloademacs-7c19d3aedbc55c4458bd8911aaa614c0c7f2c316.tar.gz
(main): Close daemon_pipe on exec.
Diffstat (limited to 'src/emacs.c')
-rw-r--r--src/emacs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/emacs.c b/src/emacs.c
index b4d09ac5d2d..bd733da303f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1143,6 +1143,10 @@ main (int argc, char **argv)
daemon_name = xstrdup (dname_arg);
/* Close unused reading end of the pipe. */
close (daemon_pipe[0]);
+ /* Make sure that the used end of the pipe is closed on exec, so
+ that it is not accessible to programs started from .emacs. */
+ fcntl (daemon_pipe[1], F_SETFD, FD_CLOEXEC);
+
#ifdef HAVE_SETSID
setsid();
#endif