mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-27 06:27:51 +00:00
* src/job.c (child_execute_job): Set pid to -1 on posix_spawn failure.
This commit is contained in:
parent
069f2bca99
commit
a483334f97
1 changed files with 6 additions and 4 deletions
10
src/job.c
10
src/job.c
|
@ -2236,7 +2236,7 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
|
||||||
int fderr = FD_STDERR;
|
int fderr = FD_STDERR;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
int r;
|
int r;
|
||||||
#if USE_POSIX_SPAWN
|
#if defined(USE_POSIX_SPAWN)
|
||||||
short flags = 0;
|
short flags = 0;
|
||||||
posix_spawnattr_t attr;
|
posix_spawnattr_t attr;
|
||||||
posix_spawn_file_actions_t fa;
|
posix_spawn_file_actions_t fa;
|
||||||
|
@ -2280,8 +2280,6 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
|
||||||
|
|
||||||
#else /* use posix_spawn() */
|
#else /* use posix_spawn() */
|
||||||
|
|
||||||
pid = -1;
|
|
||||||
|
|
||||||
if ((r = posix_spawnattr_init (&attr)) != 0)
|
if ((r = posix_spawnattr_init (&attr)) != 0)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
|
@ -2338,9 +2336,13 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
|
||||||
cleanup:
|
cleanup:
|
||||||
posix_spawn_file_actions_destroy (&fa);
|
posix_spawn_file_actions_destroy (&fa);
|
||||||
posix_spawnattr_destroy (&attr);
|
posix_spawnattr_destroy (&attr);
|
||||||
#endif /* have posix_spawn() */
|
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
if (r != 0)
|
||||||
|
pid = -1;
|
||||||
|
|
||||||
|
#endif /* have posix_spawn() */
|
||||||
|
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
OSS (error, NILF, "%s: %s", argv[0], strerror (r));
|
OSS (error, NILF, "%s: %s", argv[0], strerror (r));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue