changeset 100277:8e5380a0e38c

(main): Close daemon_pipe on exec.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 08 Dec 2008 16:22:40 +0000
parents 8f4457a692c5
children 4d303931bf58
files src/ChangeLog src/emacs.c
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Dec 08 14:44:30 2008 +0000
+++ b/src/ChangeLog	Mon Dec 08 16:22:40 2008 +0000
@@ -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
--- a/src/emacs.c	Mon Dec 08 14:44:30 2008 +0000
+++ b/src/emacs.c	Mon Dec 08 16:22:40 2008 +0000
@@ -1143,6 +1143,10 @@
        	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