diff options
Diffstat (limited to 'src/machine/machined-dbus.c')
-rw-r--r-- | src/machine/machined-dbus.c | 46 |
1 files changed, 7 insertions, 39 deletions
diff --git a/src/machine/machined-dbus.c b/src/machine/machined-dbus.c index 3637815fc9..08a7f58ef5 100644 --- a/src/machine/machined-dbus.c +++ b/src/machine/machined-dbus.c @@ -1116,7 +1116,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err r = sd_bus_message_read(message, "uoss", &id, &path, &unit, &result); if (r < 0) { bus_log_parse_error(r); - return r; + return 0; } machine = hashmap_get(m->machine_units, unit); @@ -1124,8 +1124,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err return 0; if (streq_ptr(path, machine->scope_job)) { - free(machine->scope_job); - machine->scope_job = NULL; + machine->scope_job = mfree(machine->scope_job); if (machine->started) { if (streq(result, "done")) @@ -1137,8 +1136,9 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err machine_send_create_reply(machine, &e); } - } else - machine_save(machine); + } + + machine_save(machine); } machine_add_to_gc_queue(machine); @@ -1147,7 +1147,7 @@ int match_job_removed(sd_bus_message *message, void *userdata, sd_bus_error *err int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_error *error) { _cleanup_free_ char *unit = NULL; - const char *path, *interface; + const char *path; Manager *m = userdata; Machine *machine; int r; @@ -1171,36 +1171,6 @@ int match_properties_changed(sd_bus_message *message, void *userdata, sd_bus_err if (!machine) return 0; - r = sd_bus_message_read(message, "s", &interface); - if (r < 0) { - bus_log_parse_error(r); - return 0; - } - - if (streq(interface, "org.freedesktop.systemd1.Unit")) { - struct properties { - char *active_state; - char *sub_state; - } properties = {}; - - const struct bus_properties_map map[] = { - { "ActiveState", "s", NULL, offsetof(struct properties, active_state) }, - { "SubState", "s", NULL, offsetof(struct properties, sub_state) }, - {} - }; - - r = bus_message_map_properties_changed(message, map, &properties); - if (r < 0) - bus_log_parse_error(r); - else if (streq_ptr(properties.active_state, "inactive") || - streq_ptr(properties.active_state, "failed") || - streq_ptr(properties.sub_state, "auto-restart")) - machine_release_unit(machine); - - free(properties.active_state); - free(properties.sub_state); - } - machine_add_to_gc_queue(machine); return 0; } @@ -1224,9 +1194,7 @@ int match_unit_removed(sd_bus_message *message, void *userdata, sd_bus_error *er if (!machine) return 0; - machine_release_unit(machine); machine_add_to_gc_queue(machine); - return 0; } @@ -1242,7 +1210,7 @@ int match_reloading(sd_bus_message *message, void *userdata, sd_bus_error *error r = sd_bus_message_read(message, "b", &b); if (r < 0) { bus_log_parse_error(r); - return r; + return 0; } if (b) return 0; |