diff options
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d35a8b547b..8b57421431 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -1296,7 +1296,7 @@ int main(int argc, char *argv[]) { const char *home = NULL; uid_t uid = (uid_t) -1; gid_t gid = (gid_t) -1; - unsigned n_env = 0; + unsigned n_env = 2; const char *envp[] = { "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", "container=systemd-nspawn", /* LXC sets container=lxc, so follow the scheme here */ @@ -1310,8 +1310,9 @@ int main(int argc, char *argv[]) { NULL }; - envp[2] = strv_find_prefix(environ, "TERM="); - n_env = 3; + envp[n_env] = strv_find_prefix(environ, "TERM="); + if (envp[n_env]) + n_env ++; close_nointr_nofail(pipefd[1]); fd_wait_for_event(pipefd[0], POLLHUP, -1); |