]> andersk Git - moira.git/blobdiff - server/mr_main.c
don't initialize (deleted) state variable; don't print child message
[moira.git] / server / mr_main.c
index cfd30febd311f87b60aefde22139c3b58a47cf9f..9e61f2430df618b64bed1c20b9207287d9a5a4a9 100644 (file)
@@ -4,7 +4,8 @@
  *     $Header$
  *
  *     Copyright (C) 1987 by the Massachusetts Institute of Technology
- *
+ *     For copying and distribution information, please see the file
+ *     <mit-copyright.h>.
  *
  *     SMS server process.
  *
 
 static char *rcsid_sms_main_c = "$Header$";
 
+#include <mit-copyright.h>
 #include <strings.h>
 #include <sys/errno.h>
 #include <sys/signal.h>
+#include <sys/wait.h>
 #include "sms_server.h"
 
 extern CONNECTION newconn, listencon;
@@ -50,6 +53,7 @@ extern void do_client();
 extern int sigshut();
 void clist_append();
 void oplist_append();
+void reapchild();
 
 extern time_t now;
 
@@ -125,6 +129,7 @@ main(argc, argv)
         */
        
        if ((((int)signal (SIGTERM, sigshut)) < 0) ||
+           (((int)signal (SIGCHLD, reapchild)) < 0) ||
            (((int)signal (SIGHUP, sigshut)) < 0)) {
                com_err(whoami, errno, " Unable to establish signal handler.");
                exit(1);
@@ -283,7 +288,6 @@ new_connection()
         */
        cp = (client *)malloc(sizeof *cp);
        bzero(cp, sizeof(*cp));
-       cp->state = CL_STARTING;
        cp->action = CL_ACCEPT;
        cp->con = newconn;
        cp->id = counter++;
@@ -430,3 +434,20 @@ oplist_delete(oplp, op)
        }
        abort();
 }
+
+
+void reapchild()
+{
+    union wait status;
+    int pid;
+
+    if (takedown)
+      return;
+    while ((pid = wait3(&status, WNOHANG, (struct rusage *)0)) > 0) {
+       if  (status.w_termsig == 0 && status.w_retcode == 0)
+         com_err(whoami, 0, "dcm started successfully");
+       else
+         com_err(whoami, 0, "%d: startdcm exits with signal %d status %d",
+                 pid, status.w_termsig, status.w_retcode);
+    }
+}
This page took 0.034517 seconds and 4 git commands to generate.