aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2013-06-21 15:16:37 -0700
committerPaul Eggert2013-06-21 15:16:37 -0700
commitcbd6509c2955134034f776bed5cfaf1754770aee (patch)
tree1056796a28159937aea3a44587fa23373a3a14a3 /src
parentd26255f69c0a2c05c4611c377a2a4524084cb18a (diff)
downloademacs-cbd6509c2955134034f776bed5cfaf1754770aee.tar.gz
emacs-cbd6509c2955134034f776bed5cfaf1754770aee.zip
* process.c (create_process): Handle a couple more cases,
i.e., work even if new_argv and wait_child_setup[i] are cached. Use Fcall_process's style for volatile vars.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/process.c38
2 files changed, 36 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0061b7ff9db..bdb8baf65d8 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
12013-06-21 Paul Eggert <eggert@cs.ucla.edu>
2
3 * process.c (create_process): Handle a couple more cases,
4 i.e., work even if new_argv and wait_child_setup[i] are cached.
5 Use Fcall_process's style for volatile vars.
6
12013-06-21 Andreas Schwab <schwab@linux-m68k.org> 72013-06-21 Andreas Schwab <schwab@linux-m68k.org>
2 8
3 * process.c (create_process): Mark PROCESS volatile. 9 * process.c (create_process): Mark PROCESS volatile.
diff --git a/src/process.c b/src/process.c
index e74d58dcc33..c61a22c4beb 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1582,8 +1582,7 @@ create_process_1 (struct atimer *timer)
1582 1582
1583 1583
1584static void 1584static void
1585create_process (volatile Lisp_Object process, char **new_argv, 1585create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir)
1586 Lisp_Object current_dir)
1587{ 1586{
1588 int inchannel, outchannel; 1587 int inchannel, outchannel;
1589 pid_t pid; 1588 pid_t pid;
@@ -1592,11 +1591,10 @@ create_process (volatile Lisp_Object process, char **new_argv,
1592 int wait_child_setup[2]; 1591 int wait_child_setup[2];
1593#endif 1592#endif
1594 sigset_t blocked; 1593 sigset_t blocked;
1595 /* Use volatile to protect variables from being clobbered by vfork. */ 1594 int forkin, forkout;
1596 volatile int forkin, forkout; 1595 bool pty_flag = 0;
1597 volatile bool pty_flag = 0; 1596 Lisp_Object lisp_pty_name = Qnil;
1598 volatile Lisp_Object lisp_pty_name = Qnil; 1597 Lisp_Object encoded_current_dir;
1599 volatile Lisp_Object encoded_current_dir;
1600 1598
1601 inchannel = outchannel = -1; 1599 inchannel = outchannel = -1;
1602 1600
@@ -1695,7 +1693,31 @@ create_process (volatile Lisp_Object process, char **new_argv,
1695 pthread_sigmask (SIG_BLOCK, &blocked, 0); 1693 pthread_sigmask (SIG_BLOCK, &blocked, 0);
1696 1694
1697#ifndef WINDOWSNT 1695#ifndef WINDOWSNT
1698 pid = vfork (); 1696 /* vfork, and prevent local vars from being clobbered by the vfork. */
1697 {
1698 Lisp_Object volatile encoded_current_dir_volatile = encoded_current_dir;
1699 Lisp_Object volatile lisp_pty_name_volatile = lisp_pty_name;
1700 Lisp_Object volatile process_volatile = process;
1701 bool volatile pty_flag_volatile = pty_flag;
1702 char **volatile new_argv_volatile = new_argv;
1703 int volatile forkin_volatile = forkin;
1704 int volatile forkout_volatile = forkout;
1705 int volatile wait_child_setup_0_volatile = wait_child_setup[0];
1706 int volatile wait_child_setup_1_volatile = wait_child_setup[1];
1707
1708 pid = vfork ();
1709
1710 encoded_current_dir = encoded_current_dir_volatile;
1711 lisp_pty_name = lisp_pty_name_volatile;
1712 process = process_volatile;
1713 pty_flag = pty_flag_volatile;
1714 new_argv = new_argv_volatile;
1715 forkin = forkin_volatile;
1716 forkout = forkout_volatile;
1717 wait_child_setup[0] = wait_child_setup_0_volatile;
1718 wait_child_setup[1] = wait_child_setup_1_volatile;
1719 }
1720
1699 if (pid == 0) 1721 if (pid == 0)
1700#endif /* not WINDOWSNT */ 1722#endif /* not WINDOWSNT */
1701 { 1723 {