]> git.proxmox.com Git - mirror_ovs.git/commitdiff
daemon: Don't call a normal exit from the monitor a "crash".
authorBen Pfaff <blp@nicira.com>
Wed, 27 Oct 2010 16:29:08 +0000 (09:29 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 27 Oct 2010 16:29:08 +0000 (09:29 -0700)
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.

lib/daemon.c

index bc28973fc6a2d3d62c3aa7c270659387b8e3f0e1..91e0404e9c1e912a8ca9801c4874ced9663b2cec 100644 (file)
@@ -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);
             }
         }