threads / discuss / 7881

Do not barf on too long action description

Subject: Do not barf on too long action description

## tl;dr

One message between Apr 28, 2007 and Apr 28, 2007.

replies: 0people: 1as markdown or json

Junio C Hamano· Apr 28, 2007, 07:15 UTC · lore

Reflog message is primarily about easier identification, and leaving truncated entry is much better than dying.

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 builtin-fetch--tool.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c
index 3145c01..1b04881 100644
--- a/builtin-fetch--tool.c
+++ b/builtin-fetch--tool.c
@@ -42,9 +42,7 @@ static int update_ref(const char *action,
 
 	if (!rla)
 		rla = "(reflog update)";
-	len = snprintf(msg, sizeof(msg), "%s: %s", rla, action);
-	if (sizeof(msg) <= len)
-		die("insanely long action");
+	snprintf(msg, sizeof(msg), "%s: %s", rla, action);
 	lock = lock_any_ref_for_update(refname, oldval);
 	if (!lock)
 		return 1;

← back to recent threads