From patchwork Sat May 20 22:06:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 9738797 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3CA756034C for ; Sat, 20 May 2017 22:06:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F16A28637 for ; Sat, 20 May 2017 22:06:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F2ABD28644; Sat, 20 May 2017 22:06:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EDF4E28637 for ; Sat, 20 May 2017 22:06:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751049AbdETWGW (ORCPT ); Sat, 20 May 2017 18:06:22 -0400 Received: from mail.sigma-star.at ([95.130.255.111]:45996 "EHLO mail.sigma-star.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750748AbdETWGW (ORCPT ); Sat, 20 May 2017 18:06:22 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.sigma-star.at (Postfix) with ESMTP id 3EF2124E0002; Sun, 21 May 2017 00:06:18 +0200 (CEST) Received: from linux.site (richard.vpn.sigmapriv.at [10.3.0.5]) by mail.sigma-star.at (Postfix) with ESMTPSA id 4BF9824E0001; Sun, 21 May 2017 00:06:17 +0200 (CEST) From: Richard Weinberger To: fstests@vger.kernel.org Cc: dhowells@redhat.com, amir73il@gmail.com, darrick.wong@oracle.com, eguan@redhat.com, Richard Weinberger Subject: [PATCH] stat_test: Fix stx_attributes check Date: Sun, 21 May 2017 00:06:13 +0200 Message-Id: <1495317973-24072-1-git-send-email-richard@nod.at> X-Mailer: git-send-email 2.7.3 Sender: fstests-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: fstests@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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); } }