Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3336591rwb; Tue, 16 Aug 2022 00:35:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR5MLsCYRcSjtV9ibGVYLAdQ6GTEsFQvJUs+W229SiFzl/Ng/VBSSBPqcSrv9q51ZKfkiLpf X-Received: by 2002:a17:907:75c1:b0:72f:248d:5259 with SMTP id jl1-20020a17090775c100b0072f248d5259mr12837080ejc.227.1660635306473; Tue, 16 Aug 2022 00:35:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660635306; cv=none; d=google.com; s=arc-20160816; b=dNwfds2V88wEiRY4iy9/vQ234+Eh2dVB7m3lL883q+B6rgeKcxG5hFJcJY704BDml8 GQZcxPKlt4afMuD+1qoNNt8P0pdYJ4im4XVmmdC1xeXXc6nwFvqjG+mKC8HkuPd/ul/2 QrkPDAD+6aw/RVsvysoEowvAu90yyUrwp1udd0MCTYnRCNewoDeAQEQVvSwswvlcYqcq +/Vjm88HiSTJDd+udZf241MSU8ihGa+5gE6Lrvj5QWZHSLgFt6zyCVWmwxsqe4fufcAJ 7cmRFazupBfrqTF11+wmfvs4DEB5tQBeUYtyOFrMPcscB/HYis+ljhIX3qUkMpzDTfw9 vkJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=RbjAjy18aOpgDz5FKNXn/zg546d6IZ+raLXAHOpbUHI=; b=aK46TQEKRLo+zZxUZC3NCegQR4wcIkTuEvZ9yAUGzk65Ao/19Ywl2l9jeCLW7+zbex 56+GXxgEXXxtWGo/CfBM9To3nNCjrZI1c09Rldrs4/zCkWVZPLnQKA0L1eSGDQeJ0Jrp 2WS8tzkN0jxaU+Q1QSt4oOfvuzIPtde5c7mM1Sn/10g9TdwBQG5yCdDDCiyaYGwc3CLr 7YOqT8/TSoMalH0LGgsg2j/RH/umGV8M0Scs60t9RAQe1V4jPhYGmNuaKdnf14rnAQSr It3w1GVjO7boTvwcPEFXYwvYlI227JIQ0/3S0RvVpsztAxPKu4uAjZ0ECjYFqYlx8vrj WFzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m+vsK2wV; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg38-20020a170907972600b00730aaef8b3dsi9973394ejc.807.2022.08.16.00.34.40; Tue, 16 Aug 2022 00:35:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=m+vsK2wV; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231654AbiHPHH1 (ORCPT + 99 others); Tue, 16 Aug 2022 03:07:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231655AbiHPHHO (ORCPT ); Tue, 16 Aug 2022 03:07:14 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC12712AC39 for ; Mon, 15 Aug 2022 19:44:10 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id q16so8112186pgq.6 for ; Mon, 15 Aug 2022 19:44:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=RbjAjy18aOpgDz5FKNXn/zg546d6IZ+raLXAHOpbUHI=; b=m+vsK2wVB14VtgaBJtUVfKcDZDk5KGPjFsHJEWvgdTSzrZnpUT7EOZyTwseFKDuOIZ vqcWTc8VnZs+CFYceUUIpBmmpL80h/YTvh9aprKHz+sIO7BYvnrq9nFYJb4savfAs8Db ttHswdZiVfIGmZPWyweBSSyf/ByF3zBM0Ak3Vhwmf8+/fzZvR1KU8ptMysCwgcumFTt2 gShuMVPCBtIQfG3AE9fQkC9W0XSgdMXjfL5aMDn1z72SGyabhJpmOmDAkfpI56315Qpj S4WyVCjvStkr8kR/jztAM1VZfsYjhoz3B5M2TY9KokEQ4lamsUi7CKmrM39jif3yslJR Pkiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=RbjAjy18aOpgDz5FKNXn/zg546d6IZ+raLXAHOpbUHI=; b=eQCuwhIAfk07BnHhj5SpFb+ZFOIPP1qK/OjOpA32FqKjySQAVt91owYqxImtv/leZz 7XrRpA9E0ejmBnJ+03wGoHf+pNMNxWJ2BErITp16k43o2n5j8AgZmvluxktAyXCwj+4r nLMNa1o7yT2M5BeDeXY/i1fnoMKoYJggeRmPeHnTow5uPXQbFHcYhsr4BvEslGkErxeE pT+MJhl6CeQvSk7MNae84uQAaAhoaZQdTdT9f7oCUDpclyvWs2sY9AOoc3Yd2RCE2AHx jpDktjyNW673ecrD/uPPN80dTkHkgB6gLUYWx3lL6Qv81ec7oCkmEY/pYIg4MvZjX2sV tmZQ== X-Gm-Message-State: ACgBeo2TBFUkGhO4Bf4YNmYBH1ujgX6gTORjg8FSraf2xHNGav6gYdTe ynSbnWrgX8mytKgo0Gvz+qo= X-Received: by 2002:a05:6a00:1650:b0:52f:20d6:e858 with SMTP id m16-20020a056a00165000b0052f20d6e858mr18695775pfc.36.1660617850429; Mon, 15 Aug 2022 19:44:10 -0700 (PDT) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9200:a0f0::bb7a]) by smtp.gmail.com with ESMTPSA id r15-20020aa7988f000000b0052d51acf115sm7160970pfl.157.2022.08.15.19.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Aug 2022 19:44:09 -0700 (PDT) From: Khem Raj To: Steve Dickson Cc: Linux NFS Mailing list , Khem Raj , Konstantin Khorenko Subject: [PATCH v2 1/2] mountd: Check for return of stat function Date: Mon, 15 Aug 2022 19:44:02 -0700 Message-Id: <20220816024403.2694169-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org simplify the check, stat() return 0 on success -1 on failure Fixes clang reported errors e.g. | v4clients.c:29:6: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] | if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || | ^ ~~ Signed-off-by: Khem Raj Cc: Konstantin Khorenko Cc: Steve Dickson --- v2: rebased support/export/v4clients.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/export/v4clients.c b/support/export/v4clients.c index 5f15b61..3230251 100644 --- a/support/export/v4clients.c +++ b/support/export/v4clients.c @@ -26,7 +26,7 @@ void v4clients_init(void) { struct stat sb; - if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || + if (stat("/proc/fs/nfsd/clients", &sb) != 0 || !S_ISDIR(sb.st_mode)) return; if (clients_fd >= 0) -- 2.37.2