summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-04-19 22:09:34 +0200
committerLennart Poettering <lennart@poettering.net>2011-04-19 22:09:34 +0200
commitf4c0514703d3f8cca215ee1ecde0736a7c007b21 (patch)
tree8a1f37aba863ec966127fb1c201559f5d7ee19f4
parent2286fdf7c5d36864b5c46c4c784774a7cfc55213 (diff)
mount: properly parse timeouts options in the middle of the string
-rw-r--r--src/mount.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mount.c b/src/mount.c
index ded8273590..6205cb7f5a 100644
--- a/src/mount.c
+++ b/src/mount.c
@@ -460,17 +460,19 @@ static int mount_add_default_dependencies(Mount *m) {
return 0;
}
-static void mount_fix_timeouts(Mount *m) {
+static int mount_fix_timeouts(Mount *m) {
MountParameters *p;
const char *timeout = NULL;
Unit *other;
Iterator i;
usec_t u;
+ char *t;
+ int r;
assert(m);
if (!(p = get_mount_parameters_configured(m)))
- return;
+ return 0;
/* Allow configuration how long we wait for a device that
* backs a mount point to show up. This is useful to support
@@ -482,11 +484,18 @@ static void mount_fix_timeouts(Mount *m) {
else if ((timeout = mount_test_option(p->options, "x-systemd-device-timeout")))
timeout += 25;
else
- return;
+ return 0;
+
+ t = strndup(timeout, strcspn(timeout, ",;" WHITESPACE));
+ if (!t)
+ return -ENOMEM;
+
+ r = parse_usec(t, &u);
+ free(t);
- if (parse_usec(timeout, &u) < 0) {
+ if (r < 0) {
log_warning("Failed to parse timeout for %s, ignoring: %s", m->where, timeout);
- return;
+ return r;
}
SET_FOREACH(other, m->meta.dependencies[UNIT_AFTER], i) {
@@ -495,6 +504,8 @@ static void mount_fix_timeouts(Mount *m) {
other->meta.job_timeout = u;
}
+
+ return 0;
}
static int mount_verify(Mount *m) {