summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/machine/machine.c10
-rw-r--r--src/machine/machine.h1
-rw-r--r--src/machine/machined-dbus.c1
3 files changed, 8 insertions, 4 deletions
diff --git a/src/machine/machine.c b/src/machine/machine.c
index 0b0d45bb26..c0fa1b24b6 100644
--- a/src/machine/machine.c
+++ b/src/machine/machine.c
@@ -360,10 +360,12 @@ static int machine_stop_scope(Machine *m) {
if (!m->unit)
return 0;
- r = manager_stop_unit(m->manager, m->unit, &error, &job);
- if (r < 0) {
- log_error("Failed to stop machine scope: %s", bus_error_message(&error, r));
- return r;
+ if (!m->registered) {
+ r = manager_stop_unit(m->manager, m->unit, &error, &job);
+ if (r < 0) {
+ log_error("Failed to stop machine scope: %s", bus_error_message(&error, r));
+ return r;
+ }
}
free(m->scope_job);
diff --git a/src/machine/machine.h b/src/machine/machine.h
index a894a463a9..ed1c81c4f4 100644
--- a/src/machine/machine.h
+++ b/src/machine/machine.h
@@ -72,6 +72,7 @@ struct Machine {
bool in_gc_queue:1;
bool started:1;
+ bool registered:1;
sd_bus_message *create_message;
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c
index 6f8ba474fa..7c1802ce2a 100644
--- a/src/machine/machined-dbus.c
+++ b/src/machine/machined-dbus.c
@@ -223,6 +223,7 @@ static int method_create_or_register_machine(Manager *manager, sd_bus_message *m
m->leader = leader;
m->class = c;
m->id = id;
+ m->registered = true;
if (!isempty(service)) {
m->service = strdup(service);