summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-23 14:44:16 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-02-27 21:55:00 -0500
commit5674767ec2cf7d168fe9c30f78074231fbe3408c (patch)
tree9c432aef9da4343e8af56cb33001420a0245ca1c /src/nspawn
parent699ad6c06c0e235f588c900934bdf4bed421503b (diff)
nspawn: environment would be truncated with TERM unset
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index d35a8b547..8b5742143 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);