From: Richard Weinberger Date: Sat, 20 May 2017 22:06:13 +0000 (+0200) Subject: src/stat_test: Fix stx_attributes check X-Git-Tag: v2022.05.01~2037 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b14d1bb8b3f6474552f5e98fe5f5471a060a5f56;p=xfstests-dev.git 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 --- 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); } }