Commit 964fe051 by Serge Hallyn Committed by Stéphane Graber

Clear environment for container

Clear env before starting a container. Do it right before setting the container=lxc variable. Signed-off-by: 's avatarSerge Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent cc28d0b0
......@@ -130,6 +130,10 @@ int main(int argc, char *argv[])
my_args.progname, my_args.quiet))
return err;
if (clearenv()) {
SYSERROR("failed to clear environment");
/* don't error out though */
}
if (putenv("container=lxc")) {
SYSERROR("failed to set environment variable");
return err;
......
......@@ -364,6 +364,11 @@ static bool lxcapi_start(struct lxc_container *c, int useinit, char * const argv
setsid();
}
if (clearenv()) {
SYSERROR("failed to clear environment");
/* don't error out though */
}
if (putenv("container=lxc")) {
fprintf(stderr, "failed to set environment variable");
if (daemonize) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment