diff options
author | Lennart Poettering <lennart@poettering.net> | 2013-04-29 21:11:37 -0300 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2013-04-30 08:36:02 -0300 |
commit | 05947befcec9afb83b9ce48d613ff372c63e2ed1 (patch) | |
tree | 3c54249a6203ae370340b22dbef3cb0bed1c9042 /src | |
parent | 0df2d38abfc787f40149072340d79b4f7b682a24 (diff) |
units: add an easy-to-use unit template file systemd-nspawn@.service for running containers as system services
Diffstat (limited to 'src')
-rw-r--r-- | src/nspawn/nspawn.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 0a46313636..d772b478fd 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1231,9 +1231,13 @@ int main(int argc, char *argv[]) { log_parse_environment(); log_open(); - r = parse_argv(argc, argv); - if (r <= 0) + k = parse_argv(argc, argv); + if (k < 0) goto finish; + else if (k == 0) { + r = EXIT_SUCCESS; + goto finish; + } if (arg_directory) { char *p; @@ -1321,8 +1325,8 @@ int main(int argc, char *argv[]) { goto finish; } - r = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, newcg, false); - if (r <= 0 && r != -ENOENT) { + k = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, newcg, true); + if (k <= 0 && k != -ENOENT) { log_error("Container already running."); free(newcg); @@ -1366,6 +1370,8 @@ int main(int argc, char *argv[]) { goto finish; } + sd_notify(0, "READY=1"); + assert_se(sigemptyset(&mask) == 0); sigset_add_many(&mask, SIGCHLD, SIGWINCH, SIGTERM, SIGINT, -1); assert_se(sigprocmask(SIG_BLOCK, &mask, NULL) == 0); @@ -1701,8 +1707,8 @@ int main(int argc, char *argv[]) { if (saved_attr_valid) tcsetattr(STDIN_FILENO, TCSANOW, &saved_attr); - r = wait_for_terminate(pid, &status); - if (r < 0) { + k = wait_for_terminate(pid, &status); + if (k < 0) { r = EXIT_FAILURE; break; } |