Changes: http://joeyh.name/code/moreutils/news/version_0.55/ http://joeyh.name/code/moreutils/news/version_0.54/ PR: 200104 Submitted by: olgeni
38 lines
786 B
C
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)
|
|
{
|