]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
src/stat_test: Fix stx_attributes check
authorRichard Weinberger <richard@nod.at>
Sat, 20 May 2017 22:06:13 +0000 (00:06 +0200)
committerEryu Guan <eguan@redhat.com>
Tue, 23 May 2017 14:05:38 +0000 (22:05 +0800)
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@nod.at>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eryu Guan <eguan@redhat.com>
src/stat_test.c

index 3dc44bbdb71d7986794dc25906cc00befd79eca8..fc87ed5c6e8f942e509555b705a08e7544029274 100644 (file)
@@ -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);
        }
 }