summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2014-05-14 22:03:14 +0200
committerTom Gundersen <teg@jklm.no>2014-05-14 22:03:14 +0200
commite30bb6b53b0ae1d1da99c52266d9dec8c6ba0ae4 (patch)
tree4988f0029deef0a8d315f0aa4b6c861f80c5a40d /src
parent0404c609f399b2092a3de52eef9d75b0dc12e94c (diff)
core: sysvcompat - avoid repeated function call
Diffstat (limited to 'src')
-rw-r--r--src/core/service.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 4b6220e34d..172233013e 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -834,6 +834,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
FOREACH_WORD_QUOTED(w, z, strchr(t, ':')+1, i) {
char *n, *m;
+ bool is_before;
if (!(n = strndup(w, z))) {
r = -ENOMEM;
@@ -854,11 +855,13 @@ static int service_load_sysv_path(Service *s, const char *path) {
if (r == 0)
continue;
- if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && !startswith_no_case(t, "X-Start-Before:"))
+ is_before = startswith_no_case(t, "X-Start-Before:");
+
+ if (streq(m, SPECIAL_NETWORK_ONLINE_TARGET) && !is_before)
/* the network-online target is special, as it needs to be actively pulled in */
r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_WANTS, m, NULL, true);
else
- r = unit_add_dependency_by_name(u, startswith_no_case(t, "X-Start-Before:") ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true);
+ r = unit_add_dependency_by_name(u, is_before ? UNIT_BEFORE : UNIT_AFTER, m, NULL, true);
if (r < 0)
log_error_unit(u->id, "[%s:%u] Failed to add dependency on %s, ignoring: %s",