summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2017-02-02 18:27:25 +0100
committerLennart Poettering <lennart@poettering.net>2017-02-02 20:10:28 +0100
commitced58da749367fa70b00d00959272054aa7ab48a (patch)
tree9a036bdf14689f351b8fc2458b2c0cfdf552331c /src/nspawn
parent486b3d08dbf6c6b0b20e2960990f864d5d95fd37 (diff)
nspawn: shown exec() command is misleading
There's no point in updating exec_target for each binary we try to execute, if we override it right-away anyway... Let's just do this once, and include all binaries we try each time. Follow-up for 1a68e1e543fd8f899503bec00585a16ada296ef7.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 0474f61d43..5594b87efa 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -2317,14 +2317,16 @@ static int inner_child(
memcpy_safe(a + 1, arg_parameters, m * sizeof(char*));
a[1 + m] = NULL;
- exec_target = a[0] = (char*) "/usr/lib/systemd/systemd";
+ a[0] = (char*) "/usr/lib/systemd/systemd";
execve(a[0], a, env_use);
- exec_target = a[0] = (char*) "/lib/systemd/systemd";
+ a[0] = (char*) "/lib/systemd/systemd";
execve(a[0], a, env_use);
- exec_target = a[0] = (char*) "/sbin/init";
+ a[0] = (char*) "/sbin/init";
execve(a[0], a, env_use);
+
+ exec_target = "/usr/lib/systemd/systemd, /lib/systemd/systemd, /sbin/init";
} else if (!strv_isempty(arg_parameters)) {
exec_target = arg_parameters[0];
execvpe(arg_parameters[0], arg_parameters, env_use);
@@ -2333,11 +2335,10 @@ static int inner_child(
/* If we cannot change the directory, we'll end up in /, that is expected. */
(void) chdir(home ?: "/root");
- exec_target = "/bin/bash";
execle("/bin/bash", "-bash", NULL, env_use);
-
- exec_target = "/bin/sh";
execle("/bin/sh", "-sh", NULL, env_use);
+
+ exec_target = "/bin/bash, /bin/sh";
}
r = -errno;