diff --git a/src/exec.c b/src/exec.c index 97275024..4e8d9067 100644 --- a/src/exec.c +++ b/src/exec.c @@ -260,7 +260,6 @@ int run_interactive(char *cmd, char *fmt, ...) int exec_runtask(char *cmd, char *args[]) { - size_t i; char buf[1024] = ""; char *argv[4] = { "sh", @@ -268,6 +267,7 @@ int exec_runtask(char *cmd, char *args[]) buf, NULL }; + size_t i; strlcat(buf, cmd, sizeof(buf)); for (i = 1; args[i]; i++) { diff --git a/src/sig.c b/src/sig.c index 9d44f07d..cffaa4a3 100644 --- a/src/sig.c +++ b/src/sig.c @@ -296,6 +296,12 @@ void do_shutdown(shutop_t op) while (waitpid(-1, NULL, WNOHANG) > 0) ; + if (in_cont) { + if (osheading) + logit(LOG_CONSOLE | LOG_NOTICE, "%s, shutting down container.", osheading); + _exit(0); + } + /* Close all local non-console descriptors */ for (int fd = 3; fd < 128; fd++) close(fd); @@ -309,11 +315,6 @@ void do_shutdown(shutop_t op) return; } - if (in_cont) { - sync(); - goto done; - } - if (wdog) { print(kill(wdog->pid, SIGPWR) == 1, "Advising watchdog, system going down"); do_sleep(2); @@ -336,7 +337,7 @@ void do_shutdown(shutop_t op) /* Call mdadm to mark any RAID array(s) as clean before halting. */ mdadm_wait(); -done: /* Reboot via watchdog or kernel, or shutdown? */ + /* Reboot via watchdog or kernel, or shutdown? */ if (op == SHUT_REBOOT) { if (wdog && wdog->pid > 1) { int timeout = 10;