]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
split: don’t worry about ECHILD
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Mar 2023 19:42:16 +0000 (11:42 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Mar 2023 22:49:46 +0000 (14:49 -0800)
* 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.

src/split.c

index 524a4fb78bed853200c11dfac033745b4561178f..6cc9b2a89634c06efc7f087bb32b48262bdf172d 100644 (file)
@@ -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)