diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-11-21 14:54:11 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-11-22 10:24:32 +0100 |
commit | 698876640d6e8ecbcfb99acc32ad3005877842f3 (patch) | |
tree | 5b206fc5f72a8d20acef592dd227b234b2bb2ef9 /src/machine | |
parent | eec12b7756e2cada16e3b8a9c02f9eaf62df5409 (diff) | |
download | systemd-698876640d6e8ecbcfb99acc32ad3005877842f3.tar.gz |
machine: fold machine_stop_scope() into machine_stop()
No functional change.
Diffstat (limited to 'src/machine')
-rw-r--r-- | src/machine/machine.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c index d35eb1c14d..efe327f381 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -475,40 +475,31 @@ int machine_start(Machine *m, sd_bus_message *properties, sd_bus_error *error) { return 0; } -static int machine_stop_scope(Machine *m) { - _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; - char *job = NULL; - int r; - - assert(m); - assert(m->class != MACHINE_HOST); - - if (!m->unit) - return 0; - - r = manager_stop_unit(m->manager, m->unit, &error, &job); - if (r < 0) - return log_error_errno(r, "Failed to stop machine scope: %s", bus_error_message(&error, r)); - - free_and_replace(m->scope_job, job); - return 0; -} - int machine_stop(Machine *m) { int r; + assert(m); if (!IN_SET(m->class, MACHINE_CONTAINER, MACHINE_VM)) return -EOPNOTSUPP; - r = machine_stop_scope(m); + if (m->unit) { + _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; + char *job = NULL; + + r = manager_stop_unit(m->manager, m->unit, &error, &job); + if (r < 0) + return log_error_errno(r, "Failed to stop machine scope: %s", bus_error_message(&error, r)); + + free_and_replace(m->scope_job, job); + } m->stopping = true; machine_save(m); (void) manager_enqueue_nscd_cache_flush(m->manager); - return r; + return 0; } int machine_finalize(Machine *m) { |