ports/sysutils/moreutils/files/patch-moreutils-parallel.c
2015-05-10 20:15:53 +00:00

38 lines
786 B
C

--- moreutils-parallel.c.orig 2015-01-19 18:03:51 UTC
+++ moreutils-parallel.c
@@ -31,6 +31,7 @@
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
+#include <signal.h>
#ifdef __sun
# include <sys/loadavg.h> /* getloadavg() */
@@ -112,6 +113,7 @@ void exec_child(char **command, char **a
return;
}
+#ifdef HAVE_WAITID
int wait_for_child(int options) {
id_t id_ignored = 0;
siginfo_t infop;
@@ -126,6 +128,18 @@ int wait_for_child(int options) {
}
return 1;
}
+#else
+int wait_for_child(int options) {
+ int status;
+
+ if(waitpid(-1, &status, options) == -1)
+ return -1; /* nothing to wait for */
+ if(WIFEXITED(status))
+ return WEXITSTATUS(status);
+ return 1;
+}
+#endif
+
static int pipe_child(int fd, int orig_fd)
{