X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fload-fragment.c;h=e35fdbc5ecc3809676eddad82469fbc3eb5d1020;hb=3761902e2e120849c283106fd4b78b6adec7367e;hp=01f94844a6e434294d0f0661fa3503b67db9c868;hpb=c040936be2a4c77e9465cffae47d77d5ec14fb49;p=elogind.git diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 01f94844a..e35fdbc5e 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1101,15 +1101,22 @@ int config_parse_exec_mount_flags( assert(rvalue); assert(data); - FOREACH_WORD_QUOTED(w, l, rvalue, state) { - if (strncmp(w, "shared", MAX(l, 6U)) == 0) + FOREACH_WORD_SEPARATOR(w, l, rvalue, ", ", state) { + char _cleanup_free_ *t; + + t = strndup(w, l); + if (!t) + return -ENOMEM; + + if (streq(t, "shared")) flags |= MS_SHARED; - else if (strncmp(w, "slave", MAX(l, 5U)) == 0) + else if (streq(t, "slave")) flags |= MS_SLAVE; - else if (strncmp(w, "private", MAX(l, 7U)) == 0) + else if (streq(w, "private")) flags |= MS_PRIVATE; else { - log_error("[%s:%u] Failed to parse mount flags, ignoring: %s", filename, line, rvalue); + log_error("[%s:%u] Failed to parse mount flag %s, ignoring: %s", + filename, line, t, rvalue); return 0; } } @@ -1129,30 +1136,47 @@ int config_parse_timer( void *userdata) { Timer *t = data; - usec_t u; + usec_t u = 0; TimerValue *v; TimerBase b; + CalendarSpec *c = NULL; + clockid_t id; assert(filename); assert(lvalue); assert(rvalue); assert(data); - if ((b = timer_base_from_string(lvalue)) < 0) { + b = timer_base_from_string(lvalue); + if (b < 0) { log_error("[%s:%u] Failed to parse timer base, ignoring: %s", filename, line, lvalue); return 0; } - if (parse_usec(rvalue, &u) < 0) { - log_error("[%s:%u] Failed to parse timer value, ignoring: %s", filename, line, rvalue); - return 0; + if (b == TIMER_CALENDAR) { + if (calendar_spec_from_string(rvalue, &c) < 0) { + log_error("[%s:%u] Failed to parse calendar specification, ignoring: %s", filename, line, rvalue); + return 0; + } + + id = CLOCK_REALTIME; + } else { + if (parse_usec(rvalue, &u) < 0) { + log_error("[%s:%u] Failed to parse timer value, ignoring: %s", filename, line, rvalue); + return 0; + } + + id = CLOCK_MONOTONIC; } - if (!(v = new0(TimerValue, 1))) + v = new0(TimerValue, 1); + if (!v) return -ENOMEM; v->base = b; + v->clock_id = id; v->value = u; + v->calendar_spec = c; LIST_PREPEND(TimerValue, value, t->values, v);