[lxc-devel] [PATCH] Fix fd leak in lxc log

Serge Hallyn serge.hallyn at canonical.com
Mon Nov 26 17:38:19 UTC 2012


Quoting Dwight Engen (dwight.engen at oracle.com):
> lxc_log_init will leak an fd when it is called by a long running
> program that may call lxc_container_new multiple times. Fix by
> only opening the log if it is not already open.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

> ---
>  src/lxc/log.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lxc/log.c b/src/lxc/log.c
> index 7f3b6b2..02ee21c 100644
> --- a/src/lxc/log.c
> +++ b/src/lxc/log.c
> @@ -153,6 +153,9 @@ extern int lxc_log_init(const char *file, const char *priority,
>  {
>  	int lxc_priority = LXC_LOG_PRIORITY_ERROR;
>  
> +	if (lxc_log_fd != -1)
> +		return 0;
> +
>  	if (priority) {
>  		lxc_priority = lxc_log_priority_to_int(priority);
>  
> -- 
> 1.7.1
> 
> 
> ------------------------------------------------------------------------------
> Monitor your physical, virtual and cloud infrastructure from a single
> web console. Get in-depth insight into apps, servers, databases, vmware,
> SAP, cloud infrastructure, etc. Download 30-day Free Trial.
> Pricing starts from $795 for 25 servers or applications!
> http://p.sf.net/sfu/zoho_dev2dev_nov
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list