summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorDaniel Mack <github@zonque.org>2015-09-07 14:27:13 +0200
committerDaniel Mack <github@zonque.org>2015-09-07 14:27:13 +0200
commit1dc0b4e4b0dd5d59fbfc37410825c4b9a716e2b9 (patch)
treedfe5ab21884fc3848c4795d4bb702ed544d8ccba /src/core
parentc626bf1d306735a2442800c03ec10cf55442af55 (diff)
parentd11a76451f21dbec5dcc0d65444b76124764d3b5 (diff)
Merge pull request #1189 from poettering/unit-start
unit: move "not supported" check after condition check in unit_start()
Diffstat (limited to 'src/core')
-rw-r--r--src/core/unit.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/core/unit.c b/src/core/unit.c
index 45ce1b172d..1aa0321b23 100644
--- a/src/core/unit.c
+++ b/src/core/unit.c
@@ -1420,10 +1420,6 @@ int unit_start(Unit *u) {
if (u->load_state != UNIT_LOADED)
return -EINVAL;
- /* Units of types that aren't supported annot be started either */
- if (!unit_supported(u))
- return -EOPNOTSUPP;
-
/* If this is already started, then this will succeed. Note
* that this will even succeed if this unit is not startable
* by the user. This is relied on to detect when we need to
@@ -1449,6 +1445,15 @@ int unit_start(Unit *u) {
return -EPROTO;
}
+ /* Units of types that aren't supported cannot be
+ * started. Note that we do this test only after the condition
+ * checks, so that we rather return condition check errors
+ * (which are usually not considered a true failure) than "not
+ * supported" errors (which are considered a failure).
+ */
+ if (!unit_supported(u))
+ return -EOPNOTSUPP;
+
/* Forward to the main object, if we aren't it. */
following = unit_following(u);
if (following) {