X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fdbus-unit.c;h=24d8a598e7dda1db9e87d1053df8ceb5d8cd2299;hp=7a566ff7f9156eedddc5d0b5104247df9e823a7a;hb=454f7158c6cecd18555c5e7dd556e3d544301b52;hpb=556089dc57b10a12a03edd3d3e90ca17398ad206 diff --git a/src/core/dbus-unit.c b/src/core/dbus-unit.c index 7a566ff7f..24d8a598e 100644 --- a/src/core/dbus-unit.c +++ b/src/core/dbus-unit.c @@ -604,10 +604,10 @@ static int send_new_signal(sd_bus *bus, const char *destination, void *userdata) r = sd_bus_message_new_signal( bus, + &m, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "UnitNew", - &m); + "UnitNew"); if (r < 0) return r; @@ -627,36 +627,32 @@ static int send_changed_signal(sd_bus *bus, const char *destination, void *userd assert(u); p = unit_dbus_path(u); - if (!u) + if (!p) return -ENOMEM; /* Send a properties changed signal. First for the specific * type, then for the generic unit. The clients may rely on * this order to get atomic behavior if needed. */ - if (UNIT_VTABLE(u)->bus_changing_properties) { - - r = sd_bus_emit_properties_changed_strv( - bus, p, - UNIT_VTABLE(u)->bus_interface, - (char**) UNIT_VTABLE(u)->bus_changing_properties); - if (r < 0) - return r; + r = sd_bus_emit_properties_changed_strv( + bus, p, + UNIT_VTABLE(u)->bus_interface, + NULL); + if (r < 0) { + log_warning("Failed to send out specific PropertiesChanged signal for %s: %s", u->id, strerror(-r)); + return r; } - return sd_bus_emit_properties_changed( + r = sd_bus_emit_properties_changed_strv( bus, p, "org.freedesktop.systemd1.Unit", - "ActiveState", - "SubState", - "InactiveExitTimestamp", - "ActiveEnterTimestamp", - "ActiveExitTimestamp", - "InactiveEnterTimestamp", - "Job", - "ConditionResult", - "ConditionTimestamp", NULL); + if (r < 0) { + log_warning("Failed to send out generic PropertiesChanged signal for %s: %s", u->id, strerror(-r)); + return r; + } + + return 0; } void bus_unit_send_change_signal(Unit *u) { @@ -693,10 +689,10 @@ static int send_removed_signal(sd_bus *bus, const char *destination, void *userd r = sd_bus_message_new_signal( bus, + &m, "/org/freedesktop/systemd1", "org.freedesktop.systemd1.Manager", - "UnitRemoved", - &m); + "UnitRemoved"); if (r < 0) return r; @@ -817,7 +813,7 @@ static int bus_unit_set_transient_property( if (r < 0) return r; - if (!unit_name_is_valid(s, false) || !endswith(s, ".slice")) + if (!unit_name_is_valid(s, TEMPLATE_INVALID) || !endswith(s, ".slice")) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid slice name %s", s); if (isempty(s)) { @@ -869,7 +865,7 @@ static int bus_unit_set_transient_property( return r; while ((r = sd_bus_message_read(message, "s", &other)) > 0) { - if (!unit_name_is_valid(other, false)) + if (!unit_name_is_valid(other, TEMPLATE_INVALID)) return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name %s", other); if (mode != UNIT_CHECK) { @@ -914,9 +910,6 @@ int bus_unit_set_properties( assert(u); assert(message); - if (u->transient) - mode &= UNIT_RUNTIME; - /* We iterate through the array twice. First run we just check * if all passed data is valid, second run actually applies * it. This is to implement transaction-like behaviour without