Skip to content

Commit a758938

Browse files
committed
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
2 parents 107313e + c63adab commit a758938

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

usage.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ static void vreportf(const char *prefix, const char *err, va_list params)
1919
}
2020
memcpy(msg, prefix, prefix_len);
2121
p = msg + prefix_len;
22-
if (vsnprintf(p, pend - p, err, params) < 0)
22+
if (vsnprintf(p, pend - p, err, params) < 0) {
23+
fprintf(stderr, _("error: unable to format message: %s\n"),
24+
err);
2325
*p = '\0'; /* vsnprintf() failed, clip at prefix */
26+
}
2427

2528
for (; p != pend - 1 && *p; p++) {
2629
if (iscntrl(*p) && *p != '\t' && *p != '\n')

0 commit comments

Comments
 (0)