process: reset the signal mask if the fork fails (#3537)

Fix a regression that sneaked into posix spawn changes.

Refs: https://github.com/libuv/libuv/pull/3257
This commit is contained in:
Jameson Nash 2022-03-11 12:05:24 -05:00 committed by GitHub
parent 08fe5aabff
commit bc9cd56345
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
@ -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;
}