summaryrefslogtreecommitdiff
path: root/src/load-fragment.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-01-05 16:06:35 +0100
committerLennart Poettering <lennart@poettering.net>2011-01-05 16:06:35 +0100
commit5f7c426e2a7f72c473f98be9978d243db79d8910 (patch)
treebe5023d062e91526d7394d6624dc0e2d44d6cd5c /src/load-fragment.c
parent38752828029e72e72d80519bb6c67354782ddb72 (diff)
fragment: properly handle quotes in assignments in EnvironmentFile= files
Diffstat (limited to 'src/load-fragment.c')
-rw-r--r--src/load-fragment.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/load-fragment.c b/src/load-fragment.c
index 1b23205a2f..281863264e 100644
--- a/src/load-fragment.c
+++ b/src/load-fragment.c
@@ -1360,7 +1360,7 @@ static int config_parse_env_file(
}
while (!feof(f)) {
- char l[LINE_MAX], *p;
+ char l[LINE_MAX], *p, *u;
char **t;
if (!fgets(l, sizeof(l), f)) {
@@ -1381,7 +1381,21 @@ static int config_parse_env_file(
if (strchr(COMMENTS, *p))
continue;
- t = strv_env_set(*env, p);
+ if (!(u = normalize_env_assignment(p))) {
+ log_error("Out of memory");
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ t = strv_env_set(*env, u);
+ free(u);
+
+ if (!t) {
+ log_error("Out of memory");
+ r = -ENOMEM;
+ goto finish;
+ }
+
strv_free(*env);
*env = t;
}