summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/split.c6
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)