]> git.ipfire.org Git - thirdparty/git.git/blobdiff - usage.c
Merge branch 'master' of git://github.com/git-l10n/git-po
[thirdparty/git.git] / usage.c
diff --git a/usage.c b/usage.c
index cdd534c9dfc4bd38ce112da62643ab2dc7b4fbe9..cc803336bd5e6761b7fd50c33dba5aa9f734c4ba 100644 (file)
--- 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();
 }