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