[lxc-devel] [PATCH] Don't attempt to symlink kmsg without rootfs->path

Serge Hallyn serge.hallyn at canonical.com
Tue Dec 11 19:18:30 UTC 2012


Quoting Dwight Engen (dwight.engen at oracle.com):
> For example doing "lxc-execute -n tmpct /bin/bash" will call setup_kmsg(), but
> in this case rootfs->mount/dev directory doesn't even exist so the call to
> symlink fails with ENOENT. Commit f62b3449 made this failure not fatal, but
> we should not even try it when we know it will fail. See similar code in
> setup_tty(), setup_console(), etc.
> 
> Signed-off-by: Dwight Engen <dwight.engen at oracle.com>

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

thanks,
-serge

> ---
>  src/lxc/conf.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/src/lxc/conf.c b/src/lxc/conf.c
> index a58f18d..bf5edfa 100644
> --- a/src/lxc/conf.c
> +++ b/src/lxc/conf.c
> @@ -1202,6 +1202,8 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs,
>  	char kpath[MAXPATHLEN];
>  	int ret;
>  
> +	if (!rootfs->path)
> +		return 0;
>  	ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount);
>  	if (ret < 0 || ret >= sizeof(kpath))
>  		return -1;
> -- 
> 1.7.1
> 




More information about the lxc-devel mailing list