[lxc-devel] [PATCH] use lxcpath as unprivileged containers log directory

Stéphane Graber stgraber at ubuntu.com
Fri Aug 22 20:00:46 UTC 2014


On Fri, Aug 22, 2014 at 03:53:09PM -0400, S.Çağlar Onur wrote:
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

That's better than nothing though I suspect we'd want a lxc.logpath
option in global_config so the user can override the default target for
those logs without having to set lxc.logfile individually for all
containers.

Acked-by: Stéphane Graber <stgraber at ubuntu.com>

> ---
>  src/lxc/log.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/src/lxc/log.c b/src/lxc/log.c
> index d5b862e..b6b3931 100644
> --- a/src/lxc/log.c
> +++ b/src/lxc/log.c
> @@ -329,11 +329,6 @@ extern int lxc_log_init(const char *name, const char *file,
>  			return 0;
>  		ret = __lxc_log_set_file(file, 1);
>  	} else {
> -
> -		/* For now, unprivileged containers have to set -l to get logging */
> -		if (geteuid())
> -			return 0;
> -
>  		/* if no name was specified, there nothing to do */
>  		if (!name)
>  			return 0;
> @@ -343,8 +338,8 @@ extern int lxc_log_init(const char *name, const char *file,
>  		if (!lxcpath)
>  			lxcpath = LOGPATH;
>  
> -		/* try LOGPATH if lxcpath is the default */
> -		if (strcmp(lxcpath, lxc_global_config_value("lxc.lxcpath")) == 0)
> +		/* try LOGPATH if lxcpath is the default for the privileged containers */
> +		if (!geteuid() && strcmp(lxcpath, lxc_global_config_value("lxc.lxcpath")) == 0)
>  			ret = _lxc_log_set_file(name, NULL, 0);
>  
>  		/* try in lxcpath */
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel

-- 
Stéphane Graber
Ubuntu developer
http://www.ubuntu.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20140822/18f7f46f/attachment.sig>


More information about the lxc-devel mailing list