mirror of
https://github.com/git/git.git
synced 2024-05-23 18:26:08 +02:00
Merge branch 'rs/usage-fallback-to-show-message-format' into next
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
This commit is contained in:
commit
9a34aed4d5
5
usage.c
5
usage.c
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue