core: don't dispatch load queue when setting Slice= for transient units

Let's be more careful when setting up the Slice= property of transient units:
let's use manager_load_unit_prepare() instead of manager_load_unit(), so that
the load queue isn't dispatched right away, because our own transient unit is
in it, and we don#t want to have it loaded until we finished initializing it.
This commit is contained in:
Lennart Poettering 2016-04-22 17:30:08 +02:00
parent 5bda1f47b3
commit aea529e5b2

View file

@ -1099,7 +1099,10 @@ static int bus_unit_set_transient_property(
if (!unit_name_is_valid(s, UNIT_NAME_PLAIN))
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid unit name '%s'", s);
r = manager_load_unit(u->manager, s, NULL, error, &slice);
/* Note that we do not dispatch the load queue here yet, as we don't want our own transient unit to be
* loaded while we are still setting it up. Or in other words, we use manager_load_unit_prepare()
* instead of manager_load_unit() on purpose, here. */
r = manager_load_unit_prepare(u->manager, s, NULL, error, &slice);
if (r < 0)
return r;