Warn for core dumps in various places.
authorFredrik Tolf <fredrik@dolda2000.com>
Tue, 20 Mar 2012 23:32:49 +0000 (00:32 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Tue, 20 Mar 2012 23:32:49 +0000 (00:32 +0100)
src/dirplex/dirplex.c
src/htextauth.c
src/multifscgi.c
src/patplex.c

index 14320ad..55b4648 100644 (file)
@@ -320,10 +320,12 @@ static void serve(struct hthead *req, int fd)
 static void chldhandler(int sig)
 {
     pid_t pid;
+    int st;
     
-    do {
-       pid = waitpid(-1, NULL, WNOHANG);
-    } while(pid > 0);
+    while((pid = waitpid(-1, &st, WNOHANG)) > 0) {
+       if(WCOREDUMP(st))
+           flog(LOG_WARNING, "child process %i dumped core", pid);
+    }
 }
 
 static void sighandler(int sig)
index 4a7e29d..c12e1a4 100644 (file)
@@ -285,6 +285,8 @@ static int auth(struct hthead *req, int fd, char *user, char *pass)
        buffree(ebuf);
        return(0);
     }
+    if(WCOREDUMP(status))
+       flog(LOG_WARNING, "htextauth: authenticator process dumped core");
     if(WIFEXITED(status) && (WEXITSTATUS(status) == 0))
        rv = 1;
     else
index 6cc232f..a865ec7 100644 (file)
@@ -66,6 +66,8 @@ static void manage(void)
        pselect(0, NULL, NULL, NULL, NULL, &ns);
        if(chdone) {
            while((ch = waitpid(-1, &st, WNOHANG)) > 0) {
+               if(WCOREDUMP(st))
+                   fprintf(stderr, "multifscgi: child %i (%s) dumped core\n", ch, chspec[0]);
                for(i = 0; i < nchildren; i++) {
                    if(children[i] == ch)
                        children[i] = 0;
@@ -108,6 +110,8 @@ static void killall(void)
            pselect(0, NULL, NULL, NULL, &to, &ns);
            if(chdone) {
                while((ch = waitpid(-1, &st, WNOHANG)) > 0) {
+                   if(WCOREDUMP(st))
+                       fprintf(stderr, "multifscgi: child %i (%s) dumped core\n", ch, chspec[0]);
                    for(i = 0; i < nchildren; i++) {
                        if(children[i] == ch)
                            children[i] = 0;
index 5506386..13fa062 100644 (file)
@@ -491,10 +491,12 @@ static void reloadconf(char *nm)
 static void chldhandler(int sig)
 {
     pid_t pid;
+    int st;
     
-    do {
-       pid = waitpid(-1, NULL, WNOHANG);
-    } while(pid > 0);
+    while((pid = waitpid(-1, &st, WNOHANG)) > 0) {
+       if(WCOREDUMP(st))
+           flog(LOG_WARNING, "child process %i dumped core", pid);
+    }
 }
 
 static void sighandler(int sig)