public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] mountd: Check for return of stat function
@ 2022-08-16  2:44 Khem Raj
  2022-08-16  2:44 ` [PATCH v2 2/2] Fix function prototypes Khem Raj
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Khem Raj @ 2022-08-16  2:44 UTC (permalink / raw)
  To: Steve Dickson; +Cc: Linux NFS Mailing list, Khem Raj, Konstantin Khorenko

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 <raj.khem@gmail.com>
Cc: Konstantin Khorenko <khorenko@virtuozzo.com>
Cc: Steve Dickson <steved@redhat.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-09-13 18:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16  2:44 [PATCH v2 1/2] mountd: Check for return of stat function Khem Raj
2022-08-16  2:44 ` [PATCH v2 2/2] Fix function prototypes Khem Raj
2022-09-13 17:37   ` Steve Dickson
2022-09-13 17:37 ` [PATCH v2 1/2] mountd: Check for return of stat function Steve Dickson
2022-09-13 17:38 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox