]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Clear environment for container
authorSerge Hallyn <serge.hallyn@canonical.com>
Thu, 20 Dec 2012 22:14:49 +0000 (16:14 -0600)
committerStéphane Graber <stgraber@ubuntu.com>
Sat, 22 Dec 2012 10:34:28 +0000 (11:34 +0100)
Clear env before starting a container.  Do it right before setting
the container=lxc variable.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/lxc_start.c
src/lxc/lxccontainer.c

index cedd908c0ae345ad4c4f85399271494e07368c42..fb756ddbac7ec0d75dd8900784ea3f0753241222 100644 (file)
@@ -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;
index fd77aac70dc4c2a70cf5dc0cdd25d37a67df0c2e..5919d2c574acca258cafa3e49c5dfe6679c0463f 100644 (file)
@@ -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) {