diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-04-16 14:50:29 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-04-16 14:50:29 -0700 |
commit | a7589384d5a54f9c135c19bd8bc5b04715cc2865 (patch) | |
tree | edb4ba27341bb7c4b92831509c9f71d27d433209 | |
parent | 107313eb11931a66ec4cd3f83bd6c260f296ad19 (diff) | |
parent | c63adab96184135718debdc8c7fc53a2abd80ca8 (diff) | |
download | git-a7589384d5a54f9c135c19bd8bc5b04715cc2865.tar.gz |
Merge branch 'rs/usage-fallback-to-show-message-format'
vreportf(), which is usede by error() and friends, has been taught
to give the error message printf-format string when its vsnprintf()
call fails, instead of showing nothing useful to identify the
nature of the error.
* rs/usage-fallback-to-show-message-format:
usage: report vsnprintf(3) failure
-rw-r--r-- | usage.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -19,8 +19,11 @@ static void vreportf(const char *prefix, const char *err, va_list params) } memcpy(msg, prefix, prefix_len); p = msg + prefix_len; - if (vsnprintf(p, pend - p, err, params) < 0) + if (vsnprintf(p, pend - p, err, params) < 0) { + fprintf(stderr, _("error: unable to format message: %s\n"), + err); *p = '\0'; /* vsnprintf() failed, clip at prefix */ + } for (; p != pend - 1 && *p; p++) { if (iscntrl(*p) && *p != '\t' && *p != '\n') |