diff options
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 38 |
1 files changed, 30 insertions, 8 deletions
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 | ||
| 1584 | static void | 1584 | static void |
| 1585 | create_process (volatile Lisp_Object process, char **new_argv, | 1585 | create_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 | { |