mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
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
This commit is contained in:
commit
a7589384d5
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 a new issue