git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] ident.c: suppress fprintf compiler warning

From
TCTarmigan Casebolt <tarmigan+git@gmail.com>
Date
Jan 17, 2010, 06:16 UTC
Message-ID
<1263708974-99619-1-git-send-email-tarmigan+git@gmail.com>
Compiling today's pu gave
    ...
    CC ident.o
    CC levenshtein.o
ident.c: In function 'fmt_ident':
ident.c:206: warning: format not a string literal and no format arguments
    CC list-objects.o
    ...

This warning seems to have appeared first in 18e95f279ec6 (ident.c: remove unused variables) which removed additional fprintf arguments.

Suppress this warning by using a literal "%s" to print the string instead of passing the string directly to fprintf.

Signed-off-by: Tarmigan Casebolt <tarmigan+git@gmail.com>
---
 ident.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/ident.c b/ident.c
index d4f6145..239112c 100644
--- a/ident.c
+++ b/ident.c
@@ -203,7 +203,7 @@ const char *fmt_ident(const char *name, const char *email,
 
 		if ((warn_on_no_name || error_on_no_name) &&
 		    name == git_default_name && env_hint) {
-			fprintf(stderr, env_hint);
+			fprintf(stderr, "%s", env_hint);
 			env_hint = NULL; /* warn only once */
 		}
 		if (error_on_no_name)
-- 
1.6.6.425.g6b174
Message 1 of 1 in “ident.c: suppress fprintf compiler warning”
  1. ident.c: suppress fprintf compiler warningTarmigan Casebolt, Jan 17, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.