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;
if (env_append(r, &k, x) < 0)
goto fail;
- if (!(*(k++) = strdup(p)))
+ if (env_append(r, &k, m) < 0)
goto fail;
*k = NULL;