All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Detect warning options during configure
@ 2022-08-15 21:55 Khem Raj
  2022-08-15 21:55 ` [PATCH 2/2] mountd: Check for return of stat function Khem Raj
  2022-08-16  2:41 ` [PATCH 1/2] Detect warning options during configure Khem Raj
  0 siblings, 2 replies; 3+ messages in thread
From: Khem Raj @ 2022-08-15 21:55 UTC (permalink / raw)
  To: linux-nfs; +Cc: Khem Raj

Certain options maybe compiler specific therefore its better
to detect them before use.

nfs_error copies the format string and appends newline to it
but compiler can forget that it was format string since its not
same fmt string that was passed. Ignore the warning

Wdiscarded-qualifiers is gcc specific and this is no longer needed

Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>

%% original patch: clang-warnings.patch

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 support/nfs/xcommon.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
index 3989f0bc..e080423f 100644
--- a/support/nfs/xcommon.c
+++ b/support/nfs/xcommon.c
@@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) {
 
      fmt2 = xstrconcat2 (fmt, "\n");
      va_start (args, fmt);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
      vfprintf (stderr, fmt2, args);
+#pragma GCC diagnostic pop
      va_end (args);
      free (fmt2);
 }
-- 
2.37.2


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

* [PATCH 2/2] mountd: Check for return of stat function
  2022-08-15 21:55 [PATCH 1/2] Detect warning options during configure Khem Raj
@ 2022-08-15 21:55 ` Khem Raj
  2022-08-16  2:41 ` [PATCH 1/2] Detect warning options during configure Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2022-08-15 21:55 UTC (permalink / raw)
  To: linux-nfs; +Cc: Khem Raj, Konstantin Khorenko, Steve Dickson

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 --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


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

* Re: [PATCH 1/2] Detect warning options during configure
  2022-08-15 21:55 [PATCH 1/2] Detect warning options during configure Khem Raj
  2022-08-15 21:55 ` [PATCH 2/2] mountd: Check for return of stat function Khem Raj
@ 2022-08-16  2:41 ` Khem Raj
  1 sibling, 0 replies; 3+ messages in thread
From: Khem Raj @ 2022-08-16  2:41 UTC (permalink / raw)
  To: raj.khem; +Cc: linux-nfs

Please ignore this patch. It was not right one. I am sending a v2

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

end of thread, other threads:[~2022-08-16  7:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15 21:55 [PATCH 1/2] Detect warning options during configure Khem Raj
2022-08-15 21:55 ` [PATCH 2/2] mountd: Check for return of stat function Khem Raj
2022-08-16  2:41 ` [PATCH 1/2] Detect warning options during configure Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.