X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fload-fragment.c;h=1f3da70aca34337bdd20383b0bcbf77f7be2c1ce;hb=bfba3256a02a0871579c4ee48d787dfe4585fd8d;hp=bbd82b9d2472d4cda178d530fbb49506da80cad4;hpb=956b78e8e3636bbf04e264ca96128edc2cbf3626;p=elogind.git diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index bbd82b9d2..1f3da70ac 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1376,10 +1376,16 @@ int config_parse_service_timeout( r = config_parse_usec(filename, line, section, lvalue, ltype, rvalue, data, userdata); - if (!r) - s->timeout_defined = true; + if (r) + return r; - return r; + if (streq(lvalue, "TimeoutSec")) { + s->start_timeout_defined = true; + s->timeout_stop_usec = s->timeout_start_usec; + } else if (streq(lvalue, "TimeoutStartSec")) + s->start_timeout_defined = true; + + return 0; } int config_parse_unit_env_file( @@ -1463,6 +1469,7 @@ int config_parse_unit_condition_path( Unit *u = data; bool trigger, negate; Condition *c; + _cleanup_free_ char *p = NULL; assert(filename); assert(lvalue); @@ -1477,12 +1484,16 @@ int config_parse_unit_condition_path( if (negate) rvalue++; - if (!path_is_absolute(rvalue)) { - log_error("[%s:%u] Path in condition not absolute, ignoring: %s", filename, line, rvalue); + p = unit_full_printf(u, rvalue); + if (!p) + return -ENOMEM; + + if (!path_is_absolute(p)) { + log_error("[%s:%u] Path in condition not absolute, ignoring: %s", filename, line, p); return 0; } - c = condition_new(cond, rvalue, trigger, negate); + c = condition_new(cond, p, trigger, negate); if (!c) return -ENOMEM; @@ -1504,21 +1515,29 @@ int config_parse_unit_condition_string( Unit *u = data; bool trigger, negate; Condition *c; + _cleanup_free_ char *s = NULL; assert(filename); assert(lvalue); assert(rvalue); assert(data); - if ((trigger = rvalue[0] == '|')) + trigger = rvalue[0] == '|'; + if (trigger) rvalue++; - if ((negate = rvalue[0] == '!')) + negate = rvalue[0] == '!'; + if (negate) rvalue++; - if (!(c = condition_new(cond, rvalue, trigger, negate))) + s = unit_full_printf(u, rvalue); + if (!s) return -ENOMEM; + c = condition_new(cond, s, trigger, negate); + if (!c) + return log_oom(); + LIST_PREPEND(Condition, conditions, u->conditions, c); return 0; } @@ -2022,7 +2041,7 @@ int config_parse_syscall_filter( ExecContext *c = data; Unit *u = userdata; - bool invert; + bool invert = false; char *w; size_t l; char *state;