From: Lennart Poettering Date: Fri, 15 Apr 2011 23:50:40 +0000 (+0200) Subject: strv: properly override settings in env_append() X-Git-Tag: v25~36 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1830b12ae8d97a1baaabe28d9ee28c77835463d;p=systemd strv: properly override settings in env_append() --- 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;