diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2023-03-04 11:42:16 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2023-03-04 14:49:46 -0800 |
commit | a110ce4ce348ad0e194409ec8075f37f51fab385 (patch) | |
tree | 8dc6018c5137590b6fa42b270c208d8951fce8fd | |
parent | 41615f0f8fe791706f977c9705138315947f4404 (diff) | |
download | coreutils-a110ce4ce348ad0e194409ec8075f37f51fab385.tar.gz |
split: don’t worry about ECHILD
* src/split.c (closeout): There should be no need for a special
case for ECHILD, since we never wait for the same child twice.
Simplify with this in mind.
-rw-r--r-- | src/split.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/split.c b/src/split.c index 524a4fb78..6cc9b2a89 100644 --- a/src/split.c +++ b/src/split.c @@ -553,10 +553,10 @@ closeout (FILE *fp, int fd, pid_t pid, char const *name) } if (pid > 0) { - int wstatus = 0; - if (waitpid (pid, &wstatus, 0) == -1 && errno != ECHILD) + int wstatus; + if (waitpid (pid, &wstatus, 0) < 0) die (EXIT_FAILURE, errno, _("waiting for child process")); - if (WIFSIGNALED (wstatus)) + else if (WIFSIGNALED (wstatus)) { int sig = WTERMSIG (wstatus); if (sig != SIGPIPE) |