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,11 +605,13 @@ int __lxc_start(const char *name, struct lxc_conf *conf, ...@@ -605,11 +605,13 @@ 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'
*/
if (WIFSIGNALED(status)) {
switch(WTERMSIG(status)) { switch(WTERMSIG(status)) {
case SIGINT: /* halt */ case SIGINT: /* halt */
DEBUG("Container halting"); DEBUG("Container halting");
...@@ -622,6 +624,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf, ...@@ -622,6 +624,7 @@ int __lxc_start(const char *name, struct lxc_conf *conf,
DEBUG("unknown exit status for init: %d\n", WTERMSIG(status)); DEBUG("unknown exit status for init: %d\n", WTERMSIG(status));
break; break;
} }
}
err = lxc_error_set_and_log(handler->pid, status); err = lxc_error_set_and_log(handler->pid, status);
out_fini: out_fini:
......
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