re-fix child reaping in wordexp

Do not retry waitpid if the child was terminated by a signal. Do not
examine status: since we are not passing any flags, we will not receive
stop or continue notifications.
This commit is contained in:
Alexander Monakov 2018-02-05 17:38:37 +03:00 committed by Rich Felker
parent cd0ae687de
commit e53296f889
1 changed files with 1 additions and 7 deletions

View File

@ -14,13 +14,7 @@
static void reap(pid_t pid) static void reap(pid_t pid)
{ {
int status; int status;
for (;;) { while (waitpid(pid, &status, 0) < 0 && errno == EINTR);
if (waitpid(pid, &status, 0) < 0) {
if (errno != EINTR) return;
} else {
if (WIFEXITED(status)) return;
}
}
} }
static char *getword(FILE *f) static char *getword(FILE *f)