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