summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-08-31 12:07:39 +0200
committerGitHub <noreply@github.com>2016-08-31 12:07:39 +0200
commit126c6aedb8055384c22ca27adc84fe1bd9bb7d32 (patch)
treefc85e6edd310b1e3af190d31d2a1c30e2ce5fe18 /src/core
parent50725d10e3417fd357abe1df2f177b8458027ac7 (diff)
parent2507992f6bec6ccb4d96abd1f55ba278a38b1723 (diff)
load-fragment: Resolve specifiers in OnCalendar and On*Sec (#4045)
Resolves #3534
Diffstat (limited to 'src/core')
-rw-r--r--src/core/load-fragment.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index d5185cf6a0..d3fc3e36d9 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1338,10 +1338,13 @@ int config_parse_timer(const char *unit,
void *userdata) {
Timer *t = data;
- usec_t u = 0;
+ usec_t usec = 0;
TimerValue *v;
TimerBase b;
CalendarSpec *c = NULL;
+ Unit *u = userdata;
+ _cleanup_free_ char *k = NULL;
+ int r;
assert(filename);
assert(lvalue);
@@ -1360,14 +1363,20 @@ int config_parse_timer(const char *unit,
return 0;
}
+ r = unit_full_printf(u, rvalue, &k);
+ if (r < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers in %s, ignoring: %m", rvalue);
+ return 0;
+ }
+
if (b == TIMER_CALENDAR) {
- if (calendar_spec_from_string(rvalue, &c) < 0) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse calendar specification, ignoring: %s", rvalue);
+ if (calendar_spec_from_string(k, &c) < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse calendar specification, ignoring: %s", k);
return 0;
}
} else {
- if (parse_sec(rvalue, &u) < 0) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse timer value, ignoring: %s", rvalue);
+ if (parse_sec(k, &usec) < 0) {
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse timer value, ignoring: %s", k);
return 0;
}
}
@@ -1379,7 +1388,7 @@ int config_parse_timer(const char *unit,
}
v->base = b;
- v->value = u;
+ v->value = usec;
v->calendar_spec = c;
LIST_PREPEND(value, t->values, v);