Skip to contentSkip to conversation

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

PATCH In review Nguyễn Thái Ngọc Duy 2 participants 2 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

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

---
 builtin/revert.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
builtin/revert.c +1 -1
index 0c61668..9b9b2e5 100644
@@ -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);
Signature · 1 line
1.7.4.74.g639db