From: Ben Pfaff Date: Wed, 27 Oct 2010 16:29:08 +0000 (-0700) Subject: daemon: Don't call a normal exit from the monitor a "crash". X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2bf9d87ae3aa946ef93cb923e560beb582f5b655;p=openvswitch daemon: Don't call a normal exit from the monitor a "crash". When the monitored child is killed with SIGTERM, the monitoring process currently logs a message like "1 crashes: pid 12345 died, killed by signal 15 (Terminated), exiting". This counts the SIGTERM as a crash, even though it's intentional. This commit changes the log message to omit the "%d crashes" part on normal termination. --- diff --git a/lib/daemon.c b/lib/daemon.c index bc28973f..91e0404e 100644 --- a/lib/daemon.c +++ b/lib/daemon.c @@ -367,13 +367,13 @@ monitor_daemon(pid_t daemon_pid) ovs_fatal(errno, "waitpid failed"); } else if (retval == daemon_pid) { char *s = process_status_msg(status); - free(status_msg); - status_msg = xasprintf("%d crashes: pid %lu died, %s", - ++crashes, - (unsigned long int) daemon_pid, s); - free(s); - if (should_restart(status)) { + free(status_msg); + status_msg = xasprintf("%d crashes: pid %lu died, %s", + ++crashes, + (unsigned long int) daemon_pid, s); + free(s); + if (WCOREDUMP(status)) { /* Disable further core dumps to save disk space. */ struct rlimit r; @@ -407,7 +407,9 @@ monitor_daemon(pid_t daemon_pid) break; } } else { - VLOG_INFO("%s, exiting", status_msg); + VLOG_INFO("pid %lu died, %s, exiting", + (unsigned long int) daemon_pid, s); + free(s); exit(0); } }