From 7c65093ae351d82a04a3e03582e8faedee798adc Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Tue, 17 Nov 2015 14:09:16 +0100 Subject: core: make unit_make_transient() more thorough Let's reset more stuff that does not apply to transient units. Also, let's readd the unito to all queues, because it's identity now changed. --- src/core/unit.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/unit.c b/src/core/unit.c index 7809bfd754..db2bac3dd6 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -3428,7 +3428,15 @@ int unit_make_transient(Unit *u) { u->load_state = UNIT_STUB; u->load_error = 0; u->transient = true; + u->fragment_path = mfree(u->fragment_path); + u->source_path = mfree(u->source_path); + u->dropin_paths = strv_free(u->dropin_paths); + u->fragment_mtime = u->source_mtime = u->dropin_mtime = 0; + + unit_add_to_dbus_queue(u); + unit_add_to_gc_queue(u); + unit_add_to_load_queue(u); return 0; } @@ -3708,7 +3716,7 @@ int unit_fail_if_symlink(Unit *u, const char* where) { bool unit_is_pristine(Unit *u) { assert(u); - /* Check if the unit already exists or is already referenced, + /* Check if the unit already exists or is already around, * in a number of different ways. Note that to cater for unit * types such as slice, we are generally fine with units that * are marked UNIT_LOADED even even though nothing was @@ -3719,8 +3727,6 @@ bool unit_is_pristine(Unit *u) { u->fragment_path || u->source_path || !strv_isempty(u->dropin_paths) || - u->refs || - set_size(u->dependencies[UNIT_REFERENCED_BY]) > 0 || u->job || u->merged_into); } -- cgit v1.2.3-54-g00ecf