summaryrefslogtreecommitdiff
path: root/src/fdevent.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2020-11-19 03:21:22 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2020-12-24 16:13:17 -0500
commit29f50bdeb0bcfcb780d4027559563587d03eb5d4 (patch)
tree7f74e485ec2554fb664bccc5e64571c431c45890 /src/fdevent.c
parent2ecbe5948d66523ed3a65f91e5873107fe5d83fb (diff)
downloadlighttpd-git-29f50bdeb0bcfcb780d4027559563587d03eb5d4.tar.gz
[multiple] fdevent_waitpid() wrapper
Diffstat (limited to 'src/fdevent.c')
-rw-r--r--src/fdevent.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fdevent.c b/src/fdevent.c
index 5c0cbff1..5369a154 100644
--- a/src/fdevent.c
+++ b/src/fdevent.c
@@ -6,7 +6,6 @@
#include "log.h"
#include <sys/types.h>
-#include <sys/wait.h>
#include "sys-socket.h"
#include <unistd.h>
@@ -800,6 +799,18 @@ pid_t fdevent_fork_execve(const char *name, char *argv[], char *envp[], int fdin
}
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+
+int fdevent_waitpid(pid_t pid, int * const status, int nb) {
+ const int flags = nb ? WNOHANG : 0;
+ pid_t rv;
+ do { rv = waitpid(pid, status, flags); } while (-1 == rv && errno == EINTR);
+ return rv;
+}
+
+
typedef struct fdevent_cmd_pipe {
pid_t pid;
int fds[2];