Skip to content

Commit

Permalink
process: reset the signal mask if the fork fails (libuv#3537)
Browse files Browse the repository at this point in the history
Fix a regression that sneaked into posix spawn changes.

Refs: libuv#3257
  • Loading branch information
vtjnash authored Mar 11, 2022
1 parent 08fe5aa commit bc9cd56
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/unix/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,6 @@ static int uv__spawn_and_init_child_fork(const uv_process_options_t* options,

*pid = fork();

if (*pid == -1) {
/* Failed to fork */
return UV__ERR(errno);
}

if (*pid == 0) {
/* Fork succeeded, in the child process */
uv__process_child_init(options, stdio_count, pipes, error_fd);
Expand All @@ -826,6 +821,10 @@ static int uv__spawn_and_init_child_fork(const uv_process_options_t* options,
if (pthread_sigmask(SIG_SETMASK, &sigoldset, NULL) != 0)
abort();

if (*pid == -1)
/* Failed to fork */
return UV__ERR(errno);

/* Fork succeeded, in the parent process */
return 0;
}
Expand Down

0 comments on commit bc9cd56

Please sign in to comment.