diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-04-30 00:35:38 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-05-01 10:15:25 -0400 |
commit | 38158b920e772ea3a7cc9dfcf705666ce3aa5ce3 (patch) | |
tree | 4106a88cbf6f55cb41694c6e7d85dd08f3108089 /src/nspawn/nspawn.c | |
parent | 57277cbe40bc9a1421c810cee39c606f11d39008 (diff) |
cgls: add --machine/-M
cg_get_machine_path is modified to include the escaped machine name
+ ".nspawn" if the machine argument is nonnull.
Diffstat (limited to 'src/nspawn/nspawn.c')
-rw-r--r-- | src/nspawn/nspawn.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d772b478fd..bbb3334ba1 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1217,7 +1217,7 @@ finish: int main(int argc, char *argv[]) { pid_t pid = 0; int r = EXIT_FAILURE, k; - _cleanup_free_ char *machine_root = NULL, *name = NULL, *escaped = NULL, *newcg = NULL; + _cleanup_free_ char *newcg = NULL; _cleanup_close_ int master = -1; int n_fd_passed; const char *console = NULL; @@ -1301,30 +1301,12 @@ int main(int argc, char *argv[]) { fdset_close_others(fds); log_open(); - k = cg_get_machine_path(&machine_root); + k = cg_get_machine_path(arg_machine, &newcg); if (k < 0) { log_error("Failed to determine machine cgroup path: %s", strerror(-k)); goto finish; } - name = strappend(arg_machine, ".nspawn"); - if (!name) { - log_oom(); - goto finish; - } - - escaped = cg_escape(name); - if (!escaped) { - log_oom(); - goto finish; - } - - newcg = strjoin(machine_root, "/", escaped, NULL); - if (!newcg) { - log_oom(); - goto finish; - } - k = cg_is_empty_recursive(SYSTEMD_CGROUP_CONTROLLER, newcg, true); if (k <= 0 && k != -ENOENT) { log_error("Container already running."); |