summaryrefslogtreecommitdiff
path: root/conf-parser.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-01-26 04:18:44 +0100
committerLennart Poettering <lennart@poettering.net>2010-01-26 04:18:44 +0100
commit034c6ed7da5e44bfdde5a5d0da75f7b7a59953b8 (patch)
treeea59315075d3ebda2de695b1bd0621d79fa9e987 /conf-parser.c
parent9152c765065184d0c1267ed2499e3fe4cac53755 (diff)
first attempt at proper service/socket logic
Diffstat (limited to 'conf-parser.c')
-rw-r--r--conf-parser.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/conf-parser.c b/conf-parser.c
index 2ea6911257..2618858331 100644
--- a/conf-parser.c
+++ b/conf-parser.c
@@ -337,6 +337,36 @@ int config_parse_string(
return 0;
}
+int config_parse_path(
+ const char *filename,
+ unsigned line,
+ const char *section,
+ const char *lvalue,
+ const char *rvalue,
+ void *data,
+ void *userdata) {
+
+ char **s = data;
+ char *n;
+
+ assert(filename);
+ assert(lvalue);
+ assert(rvalue);
+ assert(data);
+
+ if (*rvalue != '/') {
+ log_error("[%s:%u] Not an absolute path: %s", filename, line, rvalue);
+ return -EINVAL;
+ }
+
+ if (!(n = strdup(rvalue)))
+ return -ENOMEM;
+
+ free(*s);
+ *s = n;
+
+ return 0;
+}
int config_parse_strv(
const char *filename,
@@ -360,7 +390,7 @@ int config_parse_strv(
assert(data);
k = strv_length(*sv);
- FOREACH_WORD(w, &l, rvalue, state)
+ FOREACH_WORD_QUOTED(w, l, rvalue, state)
k++;
if (!(n = new(char*, k+1)))
@@ -368,7 +398,7 @@ int config_parse_strv(
for (k = 0; (*sv)[k]; k++)
n[k] = (*sv)[k];
- FOREACH_WORD(w, &l, rvalue, state)
+ FOREACH_WORD_QUOTED(w, l, rvalue, state)
if (!(n[k++] = strndup(w, l)))
goto fail;
@@ -381,6 +411,7 @@ int config_parse_strv(
fail:
for (; k > 0; k--)
free(n[k-1]);
+ free(n);
return -ENOMEM;
}