]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: use container $PATH (not host $PATH) when searching for PID 1 binaries to...
authorLennart Poettering <lennart@poettering.net>
Sat, 13 Oct 2018 11:11:32 +0000 (13:11 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Oct 2018 14:40:12 +0000 (16:40 +0200)
Fixes: #10377
src/nspawn/nspawn.c

index fb360a6f4f1590c04e608e8f403837c803db9e28..7ece7f4cdee7bb510c7174ff303421e01a2f5301 100644 (file)
@@ -2795,7 +2795,18 @@ static int inner_child(
 
                 exec_target = "/usr/lib/systemd/systemd, /lib/systemd/systemd, /sbin/init";
         } else if (!strv_isempty(arg_parameters)) {
+                const char *dollar_path;
+
                 exec_target = arg_parameters[0];
+
+                /* Use the user supplied search $PATH if there is one, or DEFAULT_PATH_COMPAT if not to search the
+                 * binary. */
+                dollar_path = strv_env_get(env_use, "PATH");
+                if (dollar_path) {
+                        if (putenv((char*) dollar_path) != 0)
+                                return log_error_errno(errno, "Failed to update $PATH: %m");
+                }
+
                 execvpe(arg_parameters[0], arg_parameters, env_use);
         } else {
                 if (!arg_chdir)