From: Lennart Poettering Date: Fri, 19 Nov 2021 14:48:01 +0000 (+0100) Subject: nspawn: use FOREACH_STRING() more X-Git-Tag: v250-rc1~197 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a50966416e382bd02f77d897d58dcd9c1b09e66d;p=thirdparty%2Fsystemd.git nspawn: use FOREACH_STRING() more --- diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index e23d042b577..e5ae382d5f5 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3513,6 +3513,7 @@ static int inner_child( (void) fdset_close_others(fds); if (arg_start_mode == START_BOOT) { + const char *init; char **a; size_t m; @@ -3523,14 +3524,13 @@ static int inner_child( memcpy_safe(a + 1, arg_parameters, m * sizeof(char*)); a[1 + m] = NULL; - a[0] = (char*) "/usr/lib/systemd/systemd"; - execve(a[0], a, env_use); - - a[0] = (char*) "/lib/systemd/systemd"; - execve(a[0], a, env_use); - - a[0] = (char*) "/sbin/init"; - execve(a[0], a, env_use); + FOREACH_STRING(init, + "/usr/lib/systemd/systemd", + "/lib/systemd/systemd", + "/sbin/init") { + a[0] = (char*) init; + execve(a[0], a, env_use); + } exec_target = "/usr/lib/systemd/systemd, /lib/systemd/systemd, /sbin/init"; } else if (!strv_isempty(arg_parameters)) {