1db854
Upstream report: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13054
1db854
Upstream commit: 21e54a94d7527e07ddc37066c8cb488f478339c9
1db854
Resolves: #1308518
1db854
1db854
--- emacs-24.3/src/callproc.c	2013-02-02 04:20:04.000000000 +0100
1db854
+++ emacs-24.3-new/src/callproc.c	2016-02-29 08:24:53.628487375 +0100
1db854
@@ -491,9 +491,6 @@ usage: (call-process PROGRAM &optional I
1db854
     }
1db854
 
1db854
   {
1db854
-    /* child_setup must clobber environ in systems with true vfork.
1db854
-       Protect it from permanent change.  */
1db854
-    register char **save_environ = environ;
1db854
     register int fd1 = fd[1];
1db854
     int fd_error = fd1;
1db854
 
1db854
@@ -640,8 +637,6 @@ usage: (call-process PROGRAM &optional I
1db854
       emacs_close (fd_error);
1db854
 #endif /* not MSDOS */
1db854
 
1db854
-    environ = save_environ;
1db854
-
1db854
     /* Close most of our fd's, but not fd[0]
1db854
        since we will use that to read input from.  */
1db854
     emacs_close (filefd);
1db854
@@ -1098,10 +1093,6 @@ add_env (char **env, char **new_env, cha
1db854
    Initialize inferior's priority, pgrp, connected dir and environment.
1db854
    then exec another program based on new_argv.
1db854
 
1db854
-   This function may change environ for the superior process.
1db854
-   Therefore, the superior process must save and restore the value
1db854
-   of environ around the vfork and the call to this function.
1db854
-
1db854
    If SET_PGRP, put the subprocess into a separate process group.
1db854
 
1db854
    CURRENT_DIR is an elisp string giving the path of the current
1db854
@@ -1308,11 +1299,7 @@ child_setup (int in, int out, int err, c
1db854
   /* setpgrp_of_tty is incorrect here; it uses input_fd.  */
1db854
   tcsetpgrp (0, pid);
1db854
 
1db854
-  /* execvp does not accept an environment arg so the only way
1db854
-     to pass this environment is to set environ.  Our caller
1db854
-     is responsible for restoring the ambient value of environ.  */
1db854
-  environ = env;
1db854
-  execvp (new_argv[0], new_argv);
1db854
+  execve (new_argv[0], new_argv, env);
1db854
 
1db854
   emacs_write (1, "Can't exec program: ", 20);
1db854
   emacs_write (1, new_argv[0], strlen (new_argv[0]));
1db854
--- emacs-24.3/src/process.c	2013-01-01 21:37:17.000000000 +0100
1db854
+++ emacs-24.3-new/src/process.c	2016-02-29 08:23:23.218671832 +0100
1db854
@@ -1606,9 +1606,6 @@ create_process (Lisp_Object process, cha
1db854
   volatile int pty_flag = 0;
1db854
   volatile Lisp_Object lisp_pty_name = Qnil;
1db854
   volatile Lisp_Object encoded_current_dir;
1db854
-#if HAVE_WORKING_VFORK
1db854
-  char **volatile save_environ;
1db854
-#endif
1db854
 
1db854
   inchannel = outchannel = -1;
1db854
 
1db854
@@ -1728,12 +1725,6 @@ create_process (Lisp_Object process, cha
1db854
   pthread_sigmask (SIG_BLOCK, &blocked, 0);
1db854
 #endif
1db854
 
1db854
-#if HAVE_WORKING_VFORK
1db854
-  /* child_setup must clobber environ on systems with true vfork.
1db854
-     Protect it from permanent change.  */
1db854
-  save_environ = environ;
1db854
-#endif
1db854
-
1db854
 #ifndef WINDOWSNT
1db854
   pid = vfork ();
1db854
   if (pid == 0)
1db854
@@ -1875,10 +1866,6 @@ create_process (Lisp_Object process, cha
1db854
 
1db854
   /* Back in the parent process.  */
1db854
 
1db854
-#if HAVE_WORKING_VFORK
1db854
-  environ = save_environ;
1db854
-#endif
1db854
-
1db854
   XPROCESS (process)->pid = pid;
1db854
 
1db854
   /* Stop blocking signals in the parent.  */
1db854
@@ -1928,7 +1915,7 @@ create_process (Lisp_Object process, cha
1db854
       /* Wait for child_setup to complete in case that vfork is
1db854
 	 actually defined as fork.  The descriptor wait_child_setup[1]
1db854
 	 of a pipe is closed at the child side either by close-on-exec
1db854
-	 on successful execvp or the _exit call in child_setup.  */
1db854
+	 on successful execve or the _exit call in child_setup.  */
1db854
       {
1db854
 	char dummy;
1db854