(main): Close daemon_pipe on exec.
authorDan Nicolaescu <dann@ics.uci.edu>
Mon, 8 Dec 2008 16:22:40 +0000 (16:22 +0000)
committerDan Nicolaescu <dann@ics.uci.edu>
Mon, 8 Dec 2008 16:22:40 +0000 (16:22 +0000)
src/ChangeLog
src/emacs.c

index 2fe9652..1eb0c5f 100644 (file)
@@ -1,3 +1,7 @@
+2008-12-08  Dan Nicolaescu  <dann@ics.uci.edu>
+
+       * emacs.c (main): Close daemon_pipe on exec.
+
 2008-12-08  Chong Yidong  <cyd@stupidchicken.com>
 
        * termchar.h (struct tty): New members termcap_term_buffer and
index b4d09ac..bd733da 100644 (file)
@@ -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