[lxc-devel] [PATCH] open_without_symlink: Don't SYSERROR on something else than ELOOP

Serge Hallyn serge.hallyn at ubuntu.com
Tue Mar 22 18:01:59 UTC 2016


Quoting Bogdan Purcareata (bogdan.purcareata at nxp.com):
> The open_without_symlink routine has been specifically created to prevent
> mounts with synlinks as source or destination. Keep SYSERROR'ing in that
> particular scenario, but leave error handling to calling functions for the
> other ones - e.g. optional bind mount when the source dir doesn't exist
> throws a nasty error.
> 
> Signed-off-by: Bogdan Purcareata <bogdan.purcareata at nxp.com>

I think this is overall good, but it should then be accompanied
by maintaining errno in safe_mount over the close(srcfd) in the
error case after the second call.

> ---
>  src/lxc/utils.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/src/lxc/utils.c b/src/lxc/utils.c
> index 6bee698..2046704 100644
> --- a/src/lxc/utils.c
> +++ b/src/lxc/utils.c
> @@ -1621,8 +1621,6 @@ static int open_without_symlink(const char *target, const char *prefix_skip)
>  			errno = saved_errno;
>  			if (errno == ELOOP)
>  				SYSERROR("%s in %s was a symbolic link!", nextpath, target);
> -			else
> -				SYSERROR("Error examining %s in %s", nextpath, target);
>  			goto out;
>  		}
>  	}
> -- 
> 1.9.1
> 
> _______________________________________________
> lxc-devel mailing list
> lxc-devel at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-devel


More information about the lxc-devel mailing list