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

[PATCH] revert: do not pass non-literal string as format to git_path()

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 23, 2011, 12:45 UTC
Message-ID
<1322052336-13619-1-git-send-email-pclouds@gmail.com>
This fixes the following warning.
    CC builtin/revert.o
builtin/revert.c: In function ‘write_cherry_pick_head’:
builtin/revert.c:311: warning: format not a string literal and no format arguments
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/revert.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 0c61668..9b9b2e5 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -308,7 +308,7 @@ static void write_cherry_pick_head(struct commit *commit, const char *pseudoref)
 
 	strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
 
-	filename = git_path(pseudoref);
+	filename = git_path("%s", pseudoref);
 	fd = open(filename, O_WRONLY | O_CREAT, 0666);
 	if (fd < 0)
 		die_errno(_("Could not open '%s' for writing"), filename);
-- 
1.7.4.74.g639db
Next: Junio C Hamano
Message 1 of 2 in “revert: do not pass non-literal string as format to git_path()”
  1. revert: do not pass non-literal string as format to git_path()Nguyễn Thái Ngọc Duy, Nov 23, 2011
  2. Junio C HamanoNov 23, 2011

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.