From b14d1bb8b3f6474552f5e98fe5f5471a060a5f56 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Sun, 21 May 2017 00:06:13 +0200 Subject: [PATCH] src/stat_test: Fix stx_attributes check 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 Reviewed-by: Darrick J. Wong Signed-off-by: Eryu Guan --- 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 3dc44bbd..fc87ed5c 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.39.5