summaryrefslogtreecommitdiff
path: root/src/core/dbus-manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-11-17 14:04:40 +0100
committerLennart Poettering <lennart@poettering.net>2015-11-17 17:32:49 +0100
commit0f13f3bd7918b84955eaa0ceeea0f964877a93f7 (patch)
tree6b87343f5f65a23ff1ec31d06af1177550f742d4 /src/core/dbus-manager.c
parent06cc6afa047deb56318ce424804bb04c4f690b30 (diff)
core: move check whether a unit is suitable to become transient into unit.c
Lets introduce unit_is_pristine() that verifies whether a unit is suitable to become a transient unit, by checking that it is no referenced yet and has no data on disk assigned.
Diffstat (limited to 'src/core/dbus-manager.c')
-rw-r--r--src/core/dbus-manager.c14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c
index 51ee5817eb..693d93f3fe 100644
--- a/src/core/dbus-manager.c
+++ b/src/core/dbus-manager.c
@@ -663,19 +663,7 @@ static int transient_unit_from_message(
if (r < 0)
return r;
- /* Check if the unit already exists or is already referenced,
- * 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
- * actually loaded, as those unit types don't require a file
- * on disk to validly load. */
-
- if (!IN_SET(u->load_state, UNIT_NOT_FOUND, UNIT_LOADED) ||
- u->fragment_path ||
- u->source_path ||
- !strv_isempty(u->dropin_paths) ||
- u->refs ||
- set_size(u->dependencies[UNIT_REFERENCED_BY]) > 0)
+ if (!unit_is_pristine(u))
return sd_bus_error_setf(error, BUS_ERROR_UNIT_EXISTS, "Unit %s already exists.", name);
/* OK, the unit failed to load and is unreferenced, now let's