summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-27 21:15:59 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-11-05 18:54:27 -0400
commit54ac349445341503b1651c17b21495039d818a82 (patch)
tree7e4c119befbc46043b383db48e15c5578aad5784 /src/core
parent035fe294b3fdc054151eacc5a75909f2c479300c (diff)
core/load-fragment: modify existing environment instead of copying strv over and over
Diffstat (limited to 'src/core')
-rw-r--r--src/core/load-fragment.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index 455c11a501..75c048a23e 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -2240,7 +2240,6 @@ int config_parse_environ(const char *unit,
for (p = rvalue;; ) {
_cleanup_free_ char *word = NULL, *k = NULL;
- char **x;
r = extract_first_word(&p, &word, NULL, EXTRACT_CUNESCAPE|EXTRACT_QUOTES);
if (r == 0)
@@ -2271,12 +2270,10 @@ int config_parse_environ(const char *unit,
continue;
}
- x = strv_env_set(*env, k);
- if (!x)
+ r = strv_env_replace(env, k);
+ if (r < 0)
return log_oom();
-
- strv_free(*env);
- *env = x;
+ k = NULL;
}
}