aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordjm2014-01-19 00:01:05 +0000
committerWynn Wolf Arbor2020-05-24 12:33:55 +0200
commit2abaaaaeb04728fa97a0acf0d00e11d5f1e8fa24 (patch)
tree1b94953711bef5025202b9f3c1b493b781e871f7
parent096631433ce11fac09344d8133512263bf4218c8 (diff)
downloadslowcgi-2abaaaaeb04728fa97a0acf0d00e11d5f1e8fa24.tar.gz
fix reaper loop that could run indefinitely
log execve() failures to syslog (very useful for debugging SCRIPT_NAME problems) ok florian@
-rw-r--r--slowcgi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/slowcgi.c b/slowcgi.c
index 9b50868..af07bd8 100644
--- a/slowcgi.c
+++ b/slowcgi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: slowcgi.c,v 1.26 2013/10/31 21:53:16 florian Exp $ */
+/* $OpenBSD: slowcgi.c,v 1.27 2014/01/19 00:01:05 djm Exp $ */
/*
* Copyright (c) 2013 David Gwynne <dlg@openbsd.org>
* Copyright (c) 2013 Florian Obser <florian@openbsd.org>
@@ -503,7 +503,7 @@ slowcgi_sig_handler(int sig, short event, void *arg)
switch (sig) {
case SIGCHLD:
- while((pid = waitpid(WAIT_ANY, &status, WNOHANG)) != -1) {
+ while((pid = waitpid(WAIT_ANY, &status, WNOHANG)) > 0) {
c = NULL;
SLIST_FOREACH(ncs, &p->requests, entry)
if (ncs->request->script_pid == pid) {
@@ -526,6 +526,8 @@ slowcgi_sig_handler(int sig, short event, void *arg)
ldebug("wait: %s", c->script_name);
}
+ if (pid == -1 && errno != ECHILD)
+ lwarn("waitpid");
break;
case SIGPIPE:
/* ignore */
@@ -893,6 +895,7 @@ exec_cgi(struct request *c)
env[i++] = env_entry->val;
env[i++] = NULL;
execve(c->script_name, argv, env);
+ lwarn("execve %s", c->script_name);
_exit(1);
}