summaryrefslogtreecommitdiff
path: root/usage.c
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-12-07 18:26:33 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-12-07 21:25:16 (GMT)
commit24f6e6d626b0125f741880918fb3b9b85f607a79 (patch)
treec683cf5245ae96f73a1f18839e620a182d3969b5 /usage.c
parent0faf84d97d21d5d29132c8c021b16afe72d9fbf3 (diff)
downloadgit-24f6e6d626b0125f741880918fb3b9b85f607a79.zip
git-24f6e6d626b0125f741880918fb3b9b85f607a79.tar.gz
git-24f6e6d626b0125f741880918fb3b9b85f607a79.tar.bz2
usage.c + gc: add and use a die_message_errno()
Change the "error: " output when we exit with 128 due to gc.log errors to use a "fatal: " prefix instead. To do this add a die_message_errno() a sibling function to the die_errno() added in a preceding commit. Before this we'd expect report_last_gc_error() to return -1 from error_errno() in this case. It already treated a status of 0 and 1 specially. Let's just document that anything that's not 0 or 1 should be returned. We could also retain the "ret < 0" behavior here without hardcoding 128 by returning -128, and having the caller do a "return -ret", but I think this makes more sense, and preserves the path from die_message*()'s return value to the "return" without hardcoding "128". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'usage.c')
-rw-r--r--usage.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/usage.c b/usage.c
index 76399ba..3d09e8e 100644
--- a/usage.c
+++ b/usage.c
@@ -233,6 +233,18 @@ int die_message(const char *err, ...)
return 128;
}
+#undef die_message_errno
+int die_message_errno(const char *fmt, ...)
+{
+ char buf[1024];
+ va_list params;
+
+ va_start(params, fmt);
+ die_message_routine(fmt_with_err(buf, sizeof(buf), fmt), params);
+ va_end(params);
+ return 128;
+}
+
#undef error_errno
int error_errno(const char *fmt, ...)
{