diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-23 14:44:16 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2013-02-27 21:55:00 -0500 |
commit | 5674767ec2cf7d168fe9c30f78074231fbe3408c (patch) | |
tree | 9c432aef9da4343e8af56cb33001420a0245ca1c /src | |
parent | 699ad6c06c0e235f588c900934bdf4bed421503b (diff) |
nspawn: environment would be truncated with TERM unset
Diffstat (limited to 'src')
-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); |