]> git.eshelyaron.com Git - emacs.git/commitdiff
* callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Mar 2011 05:56:46 +0000 (22:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Mar 2011 05:56:46 +0000 (22:56 -0700)
src/ChangeLog
src/callproc.c

index 53f66bd80323a6651f2933fc6a5d65789b68882b..b8ab24a7121cc09c9e2e3e70ba18b285c6f8c2c6 100644 (file)
@@ -1,7 +1,8 @@
 2011-03-18  Paul Eggert  <eggert@cs.ucla.edu>
 
-       * sysdep.c (sys_subshell): Use 'volatile' to avoid vfork clobbering.
-       Before, this 'volatile' was incorrectly IF_LINTted out.
+       * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
+       * sysdep.c (sys_subshell): Likewise.
+       Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
 
        * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
        This should get cleaned up, so that child_setup has the
index 04b8aa3332d267061a9927cb7b34e22d8f04bbdc..75f239d1be20e98d428278bdadd899cb2eb292d3 100644 (file)
@@ -180,7 +180,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   (int nargs, register Lisp_Object *args)
 {
   Lisp_Object infile, buffer, current_dir, path;
-  int display_p;
+  volatile int display_p_volatile;
   int fd[2];
   int filefd;
   register int pid;
@@ -190,6 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   int bufsize = CALLPROC_BUFFER_SIZE_MIN;
   int count = SPECPDL_INDEX ();
 
+  const unsigned char **volatile new_argv_volatile;
   register const unsigned char **new_argv;
   /* File to use for stderr in the child.
      t means use same as standard output.  */
@@ -343,7 +344,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     UNGCPRO;
   }
 
-  display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
+  display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]);
 
   filefd = emacs_open (SSDATA (infile), O_RDONLY, 0);
   if (filefd < 0)
@@ -371,7 +372,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
       && SREF (path, 1) == ':')
     path = Fsubstring (path, make_number (2), Qnil);
 
-  new_argv = (const unsigned char **)
+  new_argv_volatile = new_argv = (const unsigned char **)
     alloca (max (2, nargs - 2) * sizeof (char *));
   if (nargs > 4)
     {
@@ -542,6 +543,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
     pid = vfork ();
 
+    new_argv = new_argv_volatile;
+
     if (pid == 0)
       {
        if (fd[0] >= 0)
@@ -673,6 +676,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     int first = 1;
     EMACS_INT total_read = 0;
     int carryover = 0;
+    int display_p = display_p_volatile;
     int display_on_the_fly = display_p;
     struct coding_system saved_coding;