Improve formatting of process termination messages in secchan logging.
[sliver-openvswitch.git] / secchan / executer.c
index 5619c51..008d2cc 100644 (file)
@@ -318,11 +318,14 @@ child_terminated(struct child *child, int status)
     if (WIFEXITED(status)) {
         ds_put_format(&ds, "normally with status %d", WEXITSTATUS(status));
     } else if (WIFSIGNALED(status)) {
+        const char *name = NULL;
 #ifdef HAVE_STRSIGNAL
-        ds_put_format(&ds, "by signal %s", strsignal(WTERMSIG(status)));
-#else
-        ds_put_format(&ds, "by signal %d", WTERMSIG(status));
+        name = strsignal(WTERMSIG(status));
 #endif
+        ds_put_format(&ds, "by signal %d", WTERMSIG(status));
+        if (name) {
+            ds_put_format(&ds, " (%s)", name);
+        }
     }
     if (WCOREDUMP(status)) {
         ds_put_cstr(&ds, " (core dumped)");