Linux NFS development
 help / color / mirror / Atom feed
From: Alexander Kanavin <alex@linutronix.de>
To: steved@redhat.com, linux-nfs@vger.kernel.org
Cc: Alexander Kanavin <alex@linutronix.de>
Subject: [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang
Date: Fri, 21 Mar 2025 12:31:47 +0100	[thread overview]
Message-ID: <20250321113147.3477702-1-alex@linutronix.de> (raw)

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


             reply	other threads:[~2025-03-21 11:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-21 11:31 Alexander Kanavin [this message]
2025-03-24 20:29 ` [nfs-utils][PATCH] support/nfs/xcommon.c: fix a formatting error with clang Steve Dickson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250321113147.3477702-1-alex@linutronix.de \
    --to=alex@linutronix.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox