From 97329d201064dcfb839a66e5933623f03d87eae6 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Nov 2015 14:07:38 +0100 Subject: core: dispatch load queue each time we set up a transient units manager_load_unit() will dispatch the load queue anyway, but let's make sure we also dispatch it immediately, after truning a unit into a transient one and loading the properties from the message. That way the know about the validity of the unit before we begin processing the next auxiliary unit. --- src/core/dbus-manager.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 693d93f3fe..4d730290b2 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -677,6 +677,9 @@ static int transient_unit_from_message( if (r < 0) return r; + /* Now load the missing bits of the unit we just created */ + manager_dispatch_load_queue(m); + *unit = u; return 0; @@ -687,8 +690,6 @@ static int transient_aux_units_from_message( sd_bus_message *message, sd_bus_error *error) { - Unit *u; - char *name = NULL; int r; assert(m); @@ -699,20 +700,17 @@ static int transient_aux_units_from_message( return r; while ((r = sd_bus_message_enter_container(message, 'r', "sa(sv)")) > 0) { + const char *name = NULL; + Unit *u; + r = sd_bus_message_read(message, "s", &name); if (r < 0) return r; r = transient_unit_from_message(m, message, name, &u, error); - if (r < 0 && r != -EEXIST) + if (r < 0) return r; - if (r != -EEXIST) { - r = unit_load(u); - if (r < 0) - return r; - } - r = sd_bus_message_exit_container(message); if (r < 0) return r; @@ -763,13 +761,6 @@ static int method_start_transient_unit(sd_bus_message *message, void *userdata, if (r < 0) return r; - /* And load this stub fully */ - r = unit_load(u); - if (r < 0) - return r; - - manager_dispatch_load_queue(m); - /* Finally, start it */ return bus_unit_queue_job(message, u, JOB_START, mode, false, error); } -- cgit v1.2.3-54-g00ecf