summaryrefslogtreecommitdiff
path: root/usage.c
diff options
context:
space:
mode:
Diffstat (limited to 'usage.c')
-rw-r--r--usage.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/usage.c b/usage.c
index cdd534c..cc80333 100644
--- a/usage.c
+++ b/usage.c
@@ -148,6 +148,7 @@ static const char *fmt_with_err(char *buf, int n, const char *fmt)
}
}
str_error[j] = 0;
+ /* Truncation is acceptable here */
snprintf(buf, n, "%s: %s", fmt, str_error);
return buf;
}
@@ -210,6 +211,9 @@ void warning(const char *warn, ...)
va_end(params);
}
+/* Only set this, ever, from t/helper/, when verifying that bugs are caught. */
+int BUG_exit_code;
+
static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_list params)
{
char prefix[256];
@@ -221,6 +225,8 @@ static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_lis
snprintf(prefix, sizeof(prefix), "BUG: ");
vreportf(prefix, fmt, params);
+ if (BUG_exit_code)
+ exit(BUG_exit_code);
abort();
}