summaryrefslogtreecommitdiff
path: root/src/callproc.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-05-06 00:13:19 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-05-06 00:13:19 -0700
commitb08a63ccec4bda5556777ab8538b92726fd55a1e (patch)
treeceff3193260c813b66dff7254920ef8dc4a05b3f /src/callproc.c
parent548d0a63d6212c0baef9a3d2bf0093cceb4e1136 (diff)
parent8ff0ac3c78498c905a22786aa124f59d213b99a0 (diff)
downloademacs-b08a63ccec4bda5556777ab8538b92726fd55a1e.tar.gz
emacs-b08a63ccec4bda5556777ab8538b92726fd55a1e.tar.bz2
emacs-b08a63ccec4bda5556777ab8538b92726fd55a1e.zip
Do not assume EMACS_INT is the same width as a pointer.
This prepares for a future patch that will prefer 64-bit EMACS_INT if available. That patch can be tried now, by compiling with -DWIDE_EMACS_INT, but it is temporarily not the default so that it can be further tested. Also, install some other fixes for problems discovered by the static checking of GCC 4.6.0. Fixes: debbugs:8545 debbugs:8601 debbugs:8600 debbugs:8602
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 1d3d8764ff8..946670320ca 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -193,7 +193,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
int count = SPECPDL_INDEX ();
volatile USE_SAFE_ALLOCA;
- 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. */
@@ -416,7 +415,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
SAFE_ALLOCA (new_argv, const unsigned char **,
(nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv);
- new_argv_volatile = new_argv;
if (nargs > 4)
{
register size_t i;
@@ -591,9 +589,20 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
BLOCK_INPUT;
- pid = vfork ();
+ /* vfork, and prevent local vars from being clobbered by the vfork. */
+ {
+ int volatile fd_error_volatile = fd_error;
+ int volatile fd_output_volatile = fd_output;
+ int volatile output_to_buffer_volatile = output_to_buffer;
+ unsigned char const **volatile new_argv_volatile = new_argv;
+
+ pid = vfork ();
- new_argv = new_argv_volatile;
+ fd_error = fd_error_volatile;
+ fd_output = fd_output_volatile;
+ output_to_buffer = output_to_buffer_volatile;
+ new_argv = new_argv_volatile;
+ }
if (pid == 0)
{