2022-08-16 02:10:22

by Khem Raj

[permalink] [raw]
Subject: [PATCH 2/2] mountd: Check for return of stat function

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 <[email protected]>
Cc: Konstantin Khorenko <[email protected]>
Cc: Steve Dickson <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
---
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 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)
--
2.37.2