]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: Fix incorrect usage of putenv
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sat, 1 Aug 2020 14:05:01 +0000 (15:05 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 3 Aug 2020 07:58:05 +0000 (09:58 +0200)
strv_env_get only returns the environment variable value. putenv expects
KEY=VALUE format strings. Use setenv instead to fix the use.

src/nspawn/nspawn.c

index 3b9493f232e26f4c15a0b7e236f5288e14afe8e2..eb7c3321acc3582e2e79903113b3c03d8b6313e3 100644 (file)
@@ -3259,7 +3259,7 @@ static int inner_child(
                  * binary. */
                 dollar_path = strv_env_get(env_use, "PATH");
                 if (dollar_path) {
-                        if (putenv((char*) dollar_path) != 0)
+                        if (setenv("PATH", dollar_path, 1) < 0)
                                 return log_error_errno(errno, "Failed to update $PATH: %m");
                 }