diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-04-16 01:50:40 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-04-16 02:03:35 +0200 |
commit | e1830b12ae8d97a1baaabe28d9ee28c77835463d (patch) | |
tree | 403d9415cb7e6eb67bd9f739781e3d0526313694 /src | |
parent | 5d6ab905c00342d012aed559a859b373512e4650 (diff) |
strv: properly override settings in env_append()
Diffstat (limited to 'src')
-rw-r--r-- | src/strv.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/strv.c b/src/strv.c index 0afd9865d9..1c15ee802c 100644 --- a/src/strv.c +++ b/src/strv.c @@ -528,6 +528,9 @@ char **strv_env_delete(char **x, unsigned n_lists, ...) { char **strv_env_set(char **x, const char *p) { char **k, **r; + char* m[2] = { (char*) p, NULL }; + + /* Overrides the env var setting of p, returns a new copy */ if (!(r = new(char*, strv_length(x)+2))) return NULL; @@ -536,7 +539,7 @@ char **strv_env_set(char **x, const char *p) { if (env_append(r, &k, x) < 0) goto fail; - if (!(*(k++) = strdup(p))) + if (env_append(r, &k, m) < 0) goto fail; *k = NULL; |