On 12/20/2012 11:14 PM, Serge Hallyn wrote:
> Clear env before starting a container.  Do it right before setting
> the container=lxc variable.
> 
> Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>

Acked-by: Stéphane Graber <stgra...@ubuntu.com>

And applied to staging. Thanks

> ---
>  src/lxc/lxc_start.c    | 4 ++++
>  src/lxc/lxccontainer.c | 5 +++++
>  2 files changed, 9 insertions(+)
> 
> diff --git a/src/lxc/lxc_start.c b/src/lxc/lxc_start.c
> index cedd908..fb756dd 100644
> --- a/src/lxc/lxc_start.c
> +++ b/src/lxc/lxc_start.c
> @@ -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;
> diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
> index fd77aac..5919d2c 100644
> --- a/src/lxc/lxccontainer.c
> +++ b/src/lxc/lxccontainer.c
> @@ -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) {
> 


-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to