diff options
author | 2012-02-07 09:01:41 -0600 | |
---|---|---|
committer | 2012-02-26 10:44:40 +0100 | |
commit | 8b004f0735b8f2d9e1dd973c2db61d55fdf743c2 (patch) | |
tree | 7d8b2863f1b74862c2f9c40cef64f5fbc760da72 | |
parent | lxc-ubuntu: Support for building a container of a foreign architecture (diff) | |
download | lxc-8b004f0735b8f2d9e1dd973c2db61d55fdf743c2.tar.gz lxc-8b004f0735b8f2d9e1dd973c2db61d55fdf743c2.tar.bz2 lxc-8b004f0735b8f2d9e1dd973c2db61d55fdf743c2.zip |
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: Serge Hallyn <serge.hallyn@canonical.com>
Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
-rw-r--r-- | src/lxc/start.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/lxc/start.c b/src/lxc/start.c index 91ce5fa..4e631b2 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -605,22 +605,25 @@ int __lxc_start(const char *name, struct lxc_conf *conf, while (waitpid(handler->pid, &status, 0) < 0 && errno == EINTR) continue; - if (!WIFSIGNALED(status)) { - printf("child process exited but was not signaled\n"); - return -1; - } - - switch(WTERMSIG(status)) { - case SIGINT: /* halt */ - DEBUG("Container halting"); - break; - case SIGHUP: /* reboot */ - DEBUG("Container rebooting"); - handler->conf->reboot = 1; - break; - default: - DEBUG("unknown exit status for init: %d\n", WTERMSIG(status)); - break; + /* + * If the child process exited but was not signaled, + * it didn't call reboot. This should mean it was an + * lxc-execute which simply exited. In any case, treat + * it as a 'halt' + */ + if (WIFSIGNALED(status)) { + switch(WTERMSIG(status)) { + case SIGINT: /* halt */ + DEBUG("Container halting"); + break; + case SIGHUP: /* reboot */ + DEBUG("Container rebooting"); + handler->conf->reboot = 1; + break; + default: + DEBUG("unknown exit status for init: %d\n", WTERMSIG(status)); + break; + } } err = lxc_error_set_and_log(handler->pid, status); |