Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame^] | 1 | From 887ecc7837962e9be77a4fea7d9122648f73a84a Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Mon, 15 Aug 2022 14:47:53 -0700 |
| 4 | Subject: [PATCH] mountd: Check for return of stat function |
| 5 | |
| 6 | simplify the check, stat() return 0 on success -1 on failure |
| 7 | |
| 8 | Fixes clang reported errors e.g. |
| 9 | |
| 10 | | v4clients.c:29:6: error: logical not is only applied to the left hand side of this comparison [-Werror,-Wlogical-not-parentheses] |
| 11 | | if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || |
| 12 | | ^ ~~ |
| 13 | |
| 14 | Upstream-Status: Submitted [https://patchwork.kernel.org/project/linux-nfs/patch/20220816024403.2694169-1-raj.khem@gmail.com/] |
| 15 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 16 | Cc: Konstantin Khorenko <khorenko@virtuozzo.com> |
| 17 | Cc: Steve Dickson <steved@redhat.com> |
| 18 | --- |
| 19 | support/export/v4clients.c | 2 +- |
| 20 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 21 | |
| 22 | diff --git a/support/export/v4clients.c b/support/export/v4clients.c |
| 23 | index 5f15b61..3230251 100644 |
| 24 | --- a/support/export/v4clients.c |
| 25 | +++ b/support/export/v4clients.c |
| 26 | @@ -26,7 +26,7 @@ void v4clients_init(void) |
| 27 | { |
| 28 | struct stat sb; |
| 29 | |
| 30 | - if (!stat("/proc/fs/nfsd/clients", &sb) == 0 || |
| 31 | + if (stat("/proc/fs/nfsd/clients", &sb) != 0 || |
| 32 | !S_ISDIR(sb.st_mode)) |
| 33 | return; |
| 34 | if (clients_fd >= 0) |