diff options
author | Lennart Poettering <lennart@poettering.net> | 2011-09-23 04:03:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2011-09-23 16:28:27 +0200 |
commit | 3bb1c6b04f93841c10d2cb1c4e2945d5a0bb8ff1 (patch) | |
tree | 705a7a0d9389c2a7d55d41fe760891a5a7af1583 | |
parent | d77c31f8f39e7a58a8437628df146f4445d710b7 (diff) |
nspawn: set env var container=systemd-nspawn, following the scheme lxc introduced
-rw-r--r-- | src/nspawn.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/nspawn.c b/src/nspawn.c index 6f484e78e0..8441c057b9 100644 --- a/src/nspawn.c +++ b/src/nspawn.c @@ -727,6 +727,7 @@ int main(int argc, char *argv[]) { gid_t gid = (gid_t) -1; 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 */ NULL, /* TERM */ NULL, /* HOME */ NULL, /* USER */ @@ -734,7 +735,7 @@ int main(int argc, char *argv[]) { NULL }; - envp[1] = strv_find_prefix(environ, "TERM="); + envp[2] = strv_find_prefix(environ, "TERM="); close_nointr_nofail(master); @@ -830,9 +831,9 @@ int main(int argc, char *argv[]) { } } - if ((asprintf((char**)(envp + 2), "HOME=%s", home? home: "/root") < 0) || - (asprintf((char**)(envp + 3), "USER=%s", arg_user? arg_user : "root") < 0) || - (asprintf((char**)(envp + 4), "LOGNAME=%s", arg_user? arg_user : "root") < 0)) { + if ((asprintf((char**)(envp + 3), "HOME=%s", home? home: "/root") < 0) || + (asprintf((char**)(envp + 4), "USER=%s", arg_user? arg_user : "root") < 0) || + (asprintf((char**)(envp + 5), "LOGNAME=%s", arg_user? arg_user : "root") < 0)) { log_error("Out of memory"); goto child_fail; } |