diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 58588dbedc..e486d55bc2 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include @@ -583,17 +584,22 @@ mgt_reap_child(void) void MGT_Child_Cli_Fail(void) { + int i; if (child_state != CH_RUNNING) return; if (child_pid < 0) return; - MGT_complain(C_ERR, "Child (%jd) not responding to CLI, killing it.", - (intmax_t)child_pid); if (MGT_FEATURE(FEATURE_NO_COREDUMP)) - (void)kill(child_pid, SIGKILL); + i = kill(child_pid, SIGKILL); + else + i = kill(child_pid, SIGQUIT); + if (i == 0) + MGT_complain(C_ERR, "Child (%jd) not responding to CLI," + " killing it.", (intmax_t)child_pid); else - (void)kill(child_pid, SIGQUIT); + MGT_complain(C_ERR, "Failed to kill child with PID %jd: %s", + (intmax_t)child_pid, strerror(errno)); } /*=====================================================================