return sd_bus_reply_method_return(message, "o", path);
}
-static int bus_unit_set_transient_property(
+static int bus_unit_set_live_property(
Unit *u,
const char *name,
sd_bus_message *message,
assert(name);
assert(message);
+ /* Handles setting properties both "live" (i.e. at any time during runtime), and during creation (for transient
+ * units that are being created). */
+
if (streq(name, "Description")) {
const char *d;
}
return 1;
+ }
+
+ return 0;
+}
+
+static int bus_unit_set_transient_property(
+ Unit *u,
+ const char *name,
+ sd_bus_message *message,
+ UnitWriteFlags flags,
+ sd_bus_error *error) {
+
+ int r;
- } else if (streq(name, "DefaultDependencies")) {
+ assert(u);
+ assert(name);
+ assert(message);
+
+ /* Handles settings when transient units are created. This settings cannot be altered anymore after the unit
+ * has been created. */
+
+ if (streq(name, "DefaultDependencies")) {
int b;
r = sd_bus_message_read(message, "b", &b);
r = UNIT_VTABLE(u)->bus_set_property(u, name, message, f, error);
if (r == 0 && u->transient && u->load_state == UNIT_STUB)
r = bus_unit_set_transient_property(u, name, message, f, error);
+ if (r == 0)
+ r = bus_unit_set_live_property(u, name, message, f, error);
if (r < 0)
return r;
+
if (r == 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_PROPERTY_READ_ONLY, "Cannot set property %s, or unknown property.", name);