[lxc-devel] [PATCH] rmdir and lxc_unpriv returns non-negative error codes

Stéphane Graber stgraber at ubuntu.com
Thu Dec 4 18:02:33 UTC 2014


On Thu, Dec 04, 2014 at 12:59:47PM -0500, S.Çağlar Onur wrote:
> Signed-off-by: S.Çağlar Onur <caglar at 10ur.org>

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

> ---
>  src/lxc/bdev.c | 4 ++--
>  src/lxc/log.c  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lxc/bdev.c b/src/lxc/bdev.c
> index 75e6896..822d62c 100644
> --- a/src/lxc/bdev.c
> +++ b/src/lxc/bdev.c
> @@ -1419,7 +1419,7 @@ static int btrfs_snapshot(const char *orig, const char *new)
>  		goto out;
>  	}
>  	// make sure the directory doesn't already exist
> -	if (rmdir(newfull) < 0 && errno != -ENOENT) {
> +	if (rmdir(newfull) < 0 && errno != ENOENT) {
>  		SYSERROR("Error removing empty new rootfs");
>  		goto out;
>  	}
> @@ -1512,7 +1512,7 @@ static int btrfs_clonepaths(struct bdev *orig, struct bdev *new, const char *old
>  		return userns_exec_1(conf, btrfs_snapshot_wrapper, &sdata);
>  	}
>  
> -	if (rmdir(new->dest) < 0 && errno != -ENOENT) {
> +	if (rmdir(new->dest) < 0 && errno != ENOENT) {
>  		SYSERROR("removing %s", new->dest);
>  		return -1;
>  	}
> diff --git a/src/lxc/log.c b/src/lxc/log.c
> index 0fe376c..ff680a9 100644
> --- a/src/lxc/log.c
> +++ b/src/lxc/log.c
> @@ -159,7 +159,7 @@ static int build_dir(const char *name)
>  		*p = '\0';
>  		if (access(n, F_OK)) {
>  			ret = lxc_unpriv(mkdir(n, 0755));
> -			if (ret && errno != -EEXIST) {
> +			if (ret && errno != EEXIST) {
>  				SYSERROR("failed to create directory '%s'.", n);
>  				free(n);
>  				return -1;
> -- 
> 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/20141204/7cfbb2f3/attachment.sig>


More information about the lxc-devel mailing list