Re: [PATCH] stat_test: Fix stx_attributes check

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



On Sun, May 21, 2017 at 12:06:13AM +0200, Richard Weinberger wrote:
> I found that this test succeeds on UBIFS:
> stat_test /mnt/foo attr=+compressed attr=-compressed
> 
> Since stx_attributes can hold many flags, check the flags
> correctly with the & operator.
> 
> Signed-off-by: Richard Weinberger <richard@xxxxxx>

Looks ok to /me/...
Reviewed-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

--D

> ---
>  src/stat_test.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/stat_test.c b/src/stat_test.c
> index 3dc44bbdb71d..fc87ed5c6e8f 100644
> --- a/src/stat_test.c
> +++ b/src/stat_test.c
> @@ -621,10 +621,10 @@ static void check_attribute(const struct statx *stx, char *arg)
>  
>  	attr = p->attr_flag;
>  	if (set) {
> -		check(stx->stx_attributes && attr,
> +		check((stx->stx_attributes & attr) == attr,
>  		      "Attribute %s should be set\n", arg);
>  	} else {
> -		check(~stx->stx_attributes && attr,
> +		check((stx->stx_attributes & attr) == 0,
>  		      "Attribute %s should be unset\n", arg);
>  	}
>  }
> -- 
> 2.7.3
> 
--
To unsubscribe from this list: send the line "unsubscribe fstests" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux