Unverified Commit 13700360 by Stéphane Graber Committed by GitHub

Merge pull request #2024 from brauner/2017-11-12/fix_lxc_execute

tools: block using lxc-execute without config file
parents d987c5da 6c84b599
...@@ -163,6 +163,12 @@ int main(int argc, char *argv[]) ...@@ -163,6 +163,12 @@ int main(int argc, char *argv[])
} }
} }
if (!c->lxc_conf) {
fprintf(stderr, "Executing a container with no configuration file may crash the host\n");
lxc_container_put(c);
exit(EXIT_FAILURE);
}
if (my_args.argc == 0) { if (my_args.argc == 0) {
if (!set_argv(c->lxc_conf, &my_args)) { if (!set_argv(c->lxc_conf, &my_args)) {
fprintf(stderr, "missing command to execute!\n"); fprintf(stderr, "missing command to execute!\n");
...@@ -185,7 +191,10 @@ int main(int argc, char *argv[]) ...@@ -185,7 +191,10 @@ int main(int argc, char *argv[])
c->daemonize = my_args.daemonize == 1; c->daemonize = my_args.daemonize == 1;
bret = c->start(c, 1, my_args.argv); bret = c->start(c, 1, my_args.argv);
ret = c->error_num; if (c->daemonize)
ret = EXIT_SUCCESS;
else
ret = c->error_num;
lxc_container_put(c); lxc_container_put(c);
if (!bret) { if (!bret) {
fprintf(stderr, "Failed run an application inside container\n"); fprintf(stderr, "Failed run an application inside container\n");
......
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