[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111064: Use execve to avoid need to
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111064: Use execve to avoid need to munge environ. |
Date: |
Sun, 02 Dec 2012 11:16:45 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111064
fixes bug: http://debbugs.gnu.org/13054
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Sun 2012-12-02 11:16:45 -0800
message:
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.
modified:
src/ChangeLog
src/callproc.c
src/process.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-12-01 23:06:14 +0000
+++ b/src/ChangeLog 2012-12-02 19:16:45 +0000
@@ -1,3 +1,12 @@
+2012-12-02 Paul Eggert <address@hidden>
+
+ Use execve to avoid need to munge environ (Bug#13054).
+ * 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.
+
2012-12-01 Paul Eggert <address@hidden>
* xterm.c (x_draw_image_relief): Remove unused locals (Bug#10500).
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2012-11-29 00:36:22 +0000
+++ b/src/callproc.c 2012-12-02 19:16:45 +0000
@@ -488,9 +488,6 @@
}
{
- /* child_setup must clobber environ in systems with true vfork.
- Protect it from permanent change. */
- char **save_environ = environ;
int fd_error = fd1;
if (fd_output >= 0)
@@ -594,7 +591,6 @@
ptrdiff_t volatile count_volatile = count;
ptrdiff_t volatile sa_count_volatile = sa_count;
char **volatile new_argv_volatile = new_argv;
- char **volatile new_save_environ = save_environ;
pid = vfork ();
@@ -612,7 +608,6 @@
count = count_volatile;
sa_count = sa_count_volatile;
new_argv = new_argv_volatile;
- save_environ = new_save_environ;
}
if (pid == 0)
@@ -638,8 +633,6 @@
emacs_close (fd_error);
#endif /* not MSDOS */
- environ = save_environ;
-
/* Close most of our file descriptors, but not fd0
since we will use that to read input from. */
emacs_close (filefd);
@@ -1092,10 +1085,6 @@
Initialize inferior's priority, pgrp, connected dir and environment.
then exec another program based on new_argv.
- This function may change environ for the superior process.
- Therefore, the superior process must save and restore the value
- of environ around the vfork and the call to this function.
-
If SET_PGRP, put the subprocess into a separate process group.
CURRENT_DIR is an elisp string giving the path of the current
@@ -1298,11 +1287,7 @@
setpgid (0, 0);
tcsetpgrp (0, pid);
- /* execvp does not accept an environment arg so the only way
- to pass this environment is to set environ. Our caller
- is responsible for restoring the ambient value of environ. */
- environ = env;
- execvp (new_argv[0], new_argv);
+ execve (new_argv[0], new_argv, env);
emacs_write (1, "Can't exec program: ", 20);
emacs_write (1, new_argv[0], strlen (new_argv[0]));
=== modified file 'src/process.c'
--- a/src/process.c 2012-11-27 05:17:07 +0000
+++ b/src/process.c 2012-12-02 19:16:45 +0000
@@ -1586,9 +1586,6 @@
volatile int pty_flag = 0;
volatile Lisp_Object lisp_pty_name = Qnil;
volatile Lisp_Object encoded_current_dir;
-#if HAVE_WORKING_VFORK
- char **volatile save_environ;
-#endif
inchannel = outchannel = -1;
@@ -1688,12 +1685,6 @@
pthread_sigmask (SIG_BLOCK, &blocked, 0);
#endif
-#if HAVE_WORKING_VFORK
- /* child_setup must clobber environ on systems with true vfork.
- Protect it from permanent change. */
- save_environ = environ;
-#endif
-
#ifndef WINDOWSNT
pid = vfork ();
if (pid == 0)
@@ -1819,10 +1810,6 @@
/* Back in the parent process. */
-#if HAVE_WORKING_VFORK
- environ = save_environ;
-#endif
-
XPROCESS (process)->pid = pid;
if (0 <= pid)
XPROCESS (process)->alive = 1;
@@ -1874,7 +1861,7 @@
/* Wait for child_setup to complete in case that vfork is
actually defined as fork. The descriptor wait_child_setup[1]
of a pipe is closed at the child side either by close-on-exec
- on successful execvp or the _exit call in child_setup. */
+ on successful execve or the _exit call in child_setup. */
{
char dummy;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111064: Use execve to avoid need to munge environ.,
Paul Eggert <=