From e1830b12ae8d97a1baaabe28d9ee28c77835463d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 16 Apr 2011 01:50:40 +0200 Subject: [PATCH] strv: properly override settings in env_append() --- src/strv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/strv.c b/src/strv.c index 0afd9865..1c15ee80 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; -- 2.39.5