diff mbox series

[2/2] mountd: Check for return of stat function

Message ID 20220815215511.2595236-2-raj.khem@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/2] Detect warning options during configure | expand

Commit Message

Khem Raj Aug. 15, 2022, 9:55 p.m. UTC
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>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 support/export/v4clients.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/support/export/v4clients.c b/support/export/v4clients.c
index 5f15b614..32302512 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)