From: Dan Nicolaescu Date: Mon, 8 Dec 2008 16:22:40 +0000 (+0000) Subject: (main): Close daemon_pipe on exec. X-Git-Tag: emacs-pretest-23.0.90~1224 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7c19d3aedbc55c4458bd8911aaa614c0c7f2c316;p=emacs.git (main): Close daemon_pipe on exec. --- diff --git a/src/ChangeLog b/src/ChangeLog index 2fe9652070b..1eb0c5f02ea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2008-12-08 Dan Nicolaescu + + * emacs.c (main): Close daemon_pipe on exec. + 2008-12-08 Chong Yidong * termchar.h (struct tty): New members termcap_term_buffer and 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