aboutsummaryrefslogtreecommitdiff
path: root/strbuf.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-04-25 10:34:23 -0700
committerJunio C Hamano <gitster@pobox.com>2024-04-25 10:34:23 -0700
commitc9d1ee7cdf08f8915ed4fdd9571ecf901d074e85 (patch)
tree38fd535bff95c22436dea886b615084d73e7cd09 /strbuf.c
parent9f32d8da7aa3ec577cd47b8ce6cd05895b943626 (diff)
parent0283cd5161561b29951c00697679c10b454e541a (diff)
downloadgit-c9d1ee7cdf08f8915ed4fdd9571ecf901d074e85.tar.xz
Merge branch 'rs/vsnprintf-failure-is-not-a-bug'
Demote a BUG() to an die() when the failure from vsnprintf() may not be due to a programmer error. * rs/vsnprintf-failure-is-not-a-bug: don't report vsnprintf(3) error as bug
Diffstat (limited to 'strbuf.c')
-rw-r--r--strbuf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/strbuf.c b/strbuf.c
index 1492a08225..0d929e4e19 100644
--- a/strbuf.c
+++ b/strbuf.c
@@ -277,7 +277,7 @@ void strbuf_vinsertf(struct strbuf *sb, size_t pos, const char *fmt, va_list ap)
len = vsnprintf(sb->buf + sb->len, 0, fmt, cp);
va_end(cp);
if (len < 0)
- BUG("your vsnprintf is broken (returned %d)", len);
+ die(_("unable to format message: %s"), fmt);
if (!len)
return; /* nothing to do */
if (unsigned_add_overflows(sb->len, len))
@@ -404,7 +404,7 @@ void strbuf_vaddf(struct strbuf *sb, const char *fmt, va_list ap)
len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, cp);
va_end(cp);
if (len < 0)
- BUG("your vsnprintf is broken (returned %d)", len);
+ die(_("unable to format message: %s"), fmt);
if (len > strbuf_avail(sb)) {
strbuf_grow(sb, len);
len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap);