Commit 8b004f07 by Serge Hallyn Committed by Daniel Lezcano

Don't raise error if container didn't sys_reboot

Don't call it an error if a container exits without calling sys_reboot. Particularly since that will almost always be the case with lxc-execute. This fixes a regression introduced in commit "49296e2ebfe7c5f9d6ebafbb54f5c5e56a0cc085: support proper container reboot" Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@canonical.com> Signed-off-by: 's avatarDaniel Lezcano <dlezcano@fr.ibm.com>
parent 5a50e09a
...@@ -605,22 +605,25 @@ int __lxc_start(const char *name, struct lxc_conf *conf, ...@@ -605,22 +605,25 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
while (waitpid(handler->pid, &status, 0) < 0 && errno == EINTR) while (waitpid(handler->pid, &status, 0) < 0 && errno == EINTR)
continue; continue;
if (!WIFSIGNALED(status)) { /*
printf("child process exited but was not signaled\n"); * If the child process exited but was not signaled,
return -1; * it didn't call reboot. This should mean it was an
} * lxc-execute which simply exited. In any case, treat
* it as a 'halt'
switch(WTERMSIG(status)) { */
case SIGINT: /* halt */ if (WIFSIGNALED(status)) {
DEBUG("Container halting"); switch(WTERMSIG(status)) {
break; case SIGINT: /* halt */
case SIGHUP: /* reboot */ DEBUG("Container halting");
DEBUG("Container rebooting"); break;
handler->conf->reboot = 1; case SIGHUP: /* reboot */
break; DEBUG("Container rebooting");
default: handler->conf->reboot = 1;
DEBUG("unknown exit status for init: %d\n", WTERMSIG(status)); break;
break; default:
DEBUG("unknown exit status for init: %d\n", WTERMSIG(status));
break;
}
} }
err = lxc_error_set_and_log(handler->pid, status); err = lxc_error_set_and_log(handler->pid, status);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment