unix: remove dead code in process.c

uv_spawn() saves and restores the environ in case the child clobbers it -
which is impossible because the child process runs in a separate address space.
This commit is contained in:
Ben Noordhuis 2012-08-08 22:49:27 +02:00
parent 47f496aa65
commit d4737abd6d

View File

@ -303,7 +303,6 @@ int uv_spawn(uv_loop_t* loop,
uv_process_t* process,
const uv_process_options_t options) {
int signal_pipe[2] = { -1, -1 };
char** save_our_env;
struct pollfd pfd;
int (*pipes)[2];
int stdio_count;
@ -320,9 +319,6 @@ int uv_spawn(uv_loop_t* loop,
uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS);
loop->counters.process_init++;
/* Save environ in case it gets clobbered by the child process. */
save_our_env = environ;
stdio_count = options.stdio_count;
if (stdio_count < 3)
stdio_count = 3;
@ -378,7 +374,6 @@ int uv_spawn(uv_loop_t* loop,
if (pid == -1) {
close(signal_pipe[0]);
close(signal_pipe[1]);
environ = save_our_env;
goto error;
}
@ -387,9 +382,6 @@ int uv_spawn(uv_loop_t* loop,
abort();
}
/* Restore environment. */
environ = save_our_env;
/* POLLHUP signals child has exited or execve()'d. */
close(signal_pipe[1]);
pfd.revents = 0;