avoid zombie when execvp fails
This commit is contained in:
parent
d7f59903e3
commit
286f68524e
1 changed files with 1 additions and 0 deletions
|
|
@ -93,6 +93,7 @@ _threadspawn(int fd[3], char *cmd, char *argv[])
|
|||
n = read(p[0], exitstr, sizeof exitstr-1);
|
||||
close(p[0]);
|
||||
if(n > 0){ /* exec failed */
|
||||
free(waitfor(pid));
|
||||
exitstr[n] = 0;
|
||||
errno = atoi(exitstr);
|
||||
return -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue