Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
unix: remove dead code in process.c
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis committed Aug 8, 2012
1 parent 47f496a commit d4737ab
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions src/unix/process.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down

0 comments on commit d4737ab

Please sign in to comment.