Linux NFS development
 help / color / mirror / Atom feed
* [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang
@ 2025-03-21 11:31 Alexander Kanavin
  2025-03-24 20:29 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kanavin @ 2025-03-21 11:31 UTC (permalink / raw)
  To: steved, linux-nfs; +Cc: Alexander Kanavin

Specifically, this happens:

| xcommon.c:101:24: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
|   101 |      vfprintf (stderr, fmt2, args);
|       |                        ^~~~

A similar approach (print \n seprately) is already used elsewhere in
the same file.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 support/nfs/xcommon.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
index 3989f0bc..1d04dd11 100644
--- a/support/nfs/xcommon.c
+++ b/support/nfs/xcommon.c
@@ -94,13 +94,11 @@ xstrconcat4 (const char *s, const char *t, const char *u, const char *v) {
 void
 nfs_error (const char *fmt, ...) {
      va_list args;
-     char *fmt2;
 
-     fmt2 = xstrconcat2 (fmt, "\n");
      va_start (args, fmt);
-     vfprintf (stderr, fmt2, args);
+     vfprintf (stderr, fmt, args);
+     fprintf (stderr, "\n");
      va_end (args);
-     free (fmt2);
 }
 
 /* Make a canonical pathname from PATH.  Returns a freshly malloced string.
-- 
2.39.5


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

* Re: [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang
  2025-03-21 11:31 [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang Alexander Kanavin
@ 2025-03-24 20:29 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2025-03-24 20:29 UTC (permalink / raw)
  To: Alexander Kanavin, linux-nfs



On 3/21/25 7:31 AM, Alexander Kanavin wrote:
> Specifically, this happens:
> 
> | xcommon.c:101:24: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
> |   101 |      vfprintf (stderr, fmt2, args);
> |       |                        ^~~~
> 
> A similar approach (print \n seprately) is already used elsewhere in
> the same file.
> 
> Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Committed... (tag: nfs-utils-2-8-3-rc8)

steved.
> ---
>   support/nfs/xcommon.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/support/nfs/xcommon.c b/support/nfs/xcommon.c
> index 3989f0bc..1d04dd11 100644
> --- a/support/nfs/xcommon.c
> +++ b/support/nfs/xcommon.c
> @@ -94,13 +94,11 @@ xstrconcat4 (const char *s, const char *t, const char *u, const char *v) {
>   void
>   nfs_error (const char *fmt, ...) {
>        va_list args;
> -     char *fmt2;
>   
> -     fmt2 = xstrconcat2 (fmt, "\n");
>        va_start (args, fmt);
> -     vfprintf (stderr, fmt2, args);
> +     vfprintf (stderr, fmt, args);
> +     fprintf (stderr, "\n");
>        va_end (args);
> -     free (fmt2);
>   }
>   
>   /* Make a canonical pathname from PATH.  Returns a freshly malloced string.


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

end of thread, other threads:[~2025-03-24 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-21 11:31 [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang Alexander Kanavin
2025-03-24 20:29 ` Steve Dickson

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