chiark / gitweb /
slip: Report unexpected kinds of death from userv
[secnet.git] / slip.c
diff --git a/slip.c b/slip.c
index 1a60f40f64490f89f3b6533a55116b3d93d50b7e..3f7935a008ad16e483a3aaee72af8795b033147a 100644 (file)
--- a/slip.c
+++ b/slip.c
@@ -230,20 +230,13 @@ static void userv_userv_callback(void *sst, pid_t pid, int status)
                "(expected %d)\n",pid,st->pid);
        return;
     }
-    if (!st->expecting_userv_exit) {
-       if (WIFEXITED(status)) {
-           fatal("%s: userv exited unexpectedly with status %d",
-                 st->slip.nl.name,WEXITSTATUS(status));
-       } else if (WIFSIGNALED(status)) {
-           fatal("%s: userv exited unexpectedly: uncaught signal %d",
-                 st->slip.nl.name,WTERMSIG(status));
-       } else {
-           fatal("%s: userv stopped unexpectedly",
-                 st->slip.nl.name);
-       }
+    if (!(st->expecting_userv_exit &&
+         (!status ||
+          (WIFSIGNALED(status) && WTERMSIG(status)==SIGTERM)))) {
+       lg_exitstatus(0,st->slip.nl.name,0,
+                     st->expecting_userv_exit ? M_WARNING : M_FATAL,
+                     status,"userv");
     }
-    Message(M_WARNING,"%s: userv subprocess died with status %d\n",
-           st->slip.nl.name,WEXITSTATUS(status));
     st->pid=0;
 }
 
@@ -391,7 +384,7 @@ static void userv_phase_hook(void *sst, uint32_t newphase)
     if (newphase==PHASE_RUN) {
        userv_invoke_userv(st);
        /* Register for poll() */
-       register_for_poll(st, userv_beforepoll, userv_afterpoll, 2,
+       register_for_poll(st, userv_beforepoll, userv_afterpoll,
                          st->slip.nl.name);
     }
     if (newphase==PHASE_SHUTDOWN) {