summaryrefslogtreecommitdiff
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-03-17 22:06:34 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-03-17 22:06:34 -0700
commit7e9123a200047d0caaaa02e866aae6b7c4cebeb6 (patch)
tree7d33d368a5f0957e4088d6f818e132b1dab53b25 /src/sysdep.c
parent6bd8c14466b0787f9675279727efdff93bced7bb (diff)
downloademacs-7e9123a200047d0caaaa02e866aae6b7c4cebeb6.tar.gz
* sysdep.c (sys_subshell): Use 'volatile' to avoid vfork clobbering.
Before, this 'volatile' was incorrectly IF_LINTted out.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index 6ef3d88c5c8..889ff6d83eb 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -488,7 +488,11 @@ sys_subshell (void)
int pid;
struct save_signal saved_handlers[5];
Lisp_Object dir;
- unsigned char * IF_LINT (volatile) str = 0;
+
+ /* Volatile because otherwise vfork might clobber it on some hosts. */
+ unsigned char *volatile dirstr = 0;
+
+ unsigned char *str;
int len;
saved_handlers[0].code = SIGINT;
@@ -512,7 +516,7 @@ sys_subshell (void)
goto xyzzy;
dir = expand_and_dir_to_file (Funhandled_file_name_directory (dir), Qnil);
- str = (unsigned char *) alloca (SCHARS (dir) + 2);
+ str = dirstr = (unsigned char *) alloca (SCHARS (dir) + 2);
len = SCHARS (dir);
memcpy (str, SDATA (dir), len);
if (str[len - 1] != '/') str[len++] = '/';
@@ -544,6 +548,7 @@ sys_subshell (void)
sh = "sh";
/* Use our buffer's default directory for the subshell. */
+ str = dirstr;
if (str && chdir ((char *) str) != 0)
{
#ifndef DOS_NT