diff options
| author | Paul Eggert | 2012-12-02 11:16:45 -0800 |
|---|---|---|
| committer | Paul Eggert | 2012-12-02 11:16:45 -0800 |
| commit | 21e54a94d7527e07ddc37066c8cb488f478339c9 (patch) | |
| tree | 714c6cb2b4170123769e70a62d295cc24ed998f3 /src/process.c | |
| parent | 010db6da6527d16736fd3c2b607058dd35a70c9a (diff) | |
| download | emacs-21e54a94d7527e07ddc37066c8cb488f478339c9.tar.gz emacs-21e54a94d7527e07ddc37066c8cb488f478339c9.zip | |
Use execve to avoid need to munge environ.
* callproc.c (Fcall_process):
* process.c (create_process):
Don't save and restore environ; no longer needed.
* callproc.c (child_setup):
Use execve, not execvp, to preserve environ.
Fixes: debbugs:13054
Diffstat (limited to 'src/process.c')
| -rw-r--r-- | src/process.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/src/process.c b/src/process.c index b23f06fd025..c6139c9f929 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1586,9 +1586,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1586 | volatile int pty_flag = 0; | 1586 | volatile int pty_flag = 0; |
| 1587 | volatile Lisp_Object lisp_pty_name = Qnil; | 1587 | volatile Lisp_Object lisp_pty_name = Qnil; |
| 1588 | volatile Lisp_Object encoded_current_dir; | 1588 | volatile Lisp_Object encoded_current_dir; |
| 1589 | #if HAVE_WORKING_VFORK | ||
| 1590 | char **volatile save_environ; | ||
| 1591 | #endif | ||
| 1592 | 1589 | ||
| 1593 | inchannel = outchannel = -1; | 1590 | inchannel = outchannel = -1; |
| 1594 | 1591 | ||
| @@ -1688,12 +1685,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1688 | pthread_sigmask (SIG_BLOCK, &blocked, 0); | 1685 | pthread_sigmask (SIG_BLOCK, &blocked, 0); |
| 1689 | #endif | 1686 | #endif |
| 1690 | 1687 | ||
| 1691 | #if HAVE_WORKING_VFORK | ||
| 1692 | /* child_setup must clobber environ on systems with true vfork. | ||
| 1693 | Protect it from permanent change. */ | ||
| 1694 | save_environ = environ; | ||
| 1695 | #endif | ||
| 1696 | |||
| 1697 | #ifndef WINDOWSNT | 1688 | #ifndef WINDOWSNT |
| 1698 | pid = vfork (); | 1689 | pid = vfork (); |
| 1699 | if (pid == 0) | 1690 | if (pid == 0) |
| @@ -1819,10 +1810,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1819 | 1810 | ||
| 1820 | /* Back in the parent process. */ | 1811 | /* Back in the parent process. */ |
| 1821 | 1812 | ||
| 1822 | #if HAVE_WORKING_VFORK | ||
| 1823 | environ = save_environ; | ||
| 1824 | #endif | ||
| 1825 | |||
| 1826 | XPROCESS (process)->pid = pid; | 1813 | XPROCESS (process)->pid = pid; |
| 1827 | if (0 <= pid) | 1814 | if (0 <= pid) |
| 1828 | XPROCESS (process)->alive = 1; | 1815 | XPROCESS (process)->alive = 1; |
| @@ -1874,7 +1861,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) | |||
| 1874 | /* Wait for child_setup to complete in case that vfork is | 1861 | /* Wait for child_setup to complete in case that vfork is |
| 1875 | actually defined as fork. The descriptor wait_child_setup[1] | 1862 | actually defined as fork. The descriptor wait_child_setup[1] |
| 1876 | of a pipe is closed at the child side either by close-on-exec | 1863 | of a pipe is closed at the child side either by close-on-exec |
| 1877 | on successful execvp or the _exit call in child_setup. */ | 1864 | on successful execve or the _exit call in child_setup. */ |
| 1878 | { | 1865 | { |
| 1879 | char dummy; | 1866 | char dummy; |
| 1880 | 1867 | ||