diff options
| author | Junio C Hamano <gitster@pobox.com> | 2022-06-17 10:33:32 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2022-06-17 10:33:32 -0700 |
| commit | aa11b94ef87050af9e4e0aab64f1ab89636c5be4 (patch) | |
| tree | 5f882bc76613b2cad0faa26cc30f74dc9279c573 | |
| parent | Merge branch 'ab/credentials-in-url-more' (diff) | |
| parent | bug_fl(): correctly initialize trace2 va_list (diff) | |
| download | git-aa11b94ef87050af9e4e0aab64f1ab89636c5be4.tar.gz git-aa11b94ef87050af9e4e0aab64f1ab89636c5be4.zip | |
Merge branch 'jk/bug-fl-va-list-fix'
Fix buggy va_list usage in recent code.
* jk/bug-fl-va-list-fix:
bug_fl(): correctly initialize trace2 va_list
| -rw-r--r-- | t/helper/test-trace2.c | 4 | ||||
| -rw-r--r-- | usage.c | 8 |
2 files changed, 7 insertions, 5 deletions
diff --git a/t/helper/test-trace2.c b/t/helper/test-trace2.c index 180c7f53f3..a714130ece 100644 --- a/t/helper/test-trace2.c +++ b/t/helper/test-trace2.c @@ -224,8 +224,8 @@ static int ut_009bug_BUG(int argc, const char **argv) static int ut_010bug_BUG(int argc, const char **argv) { - bug("a bug message"); - BUG("a BUG message"); + bug("a %s message", "bug"); + BUG("a %s message", "BUG"); } /* @@ -334,15 +334,17 @@ NORETURN void BUG_fl(const char *file, int line, const char *fmt, ...) int bug_called_must_BUG; void bug_fl(const char *file, int line, const char *fmt, ...) { - va_list ap, cp; + va_list ap; bug_called_must_BUG = 1; - va_copy(cp, ap); va_start(ap, fmt); BUG_vfl_common(file, line, fmt, ap); va_end(ap); - trace2_cmd_error_va(fmt, cp); + + va_start(ap, fmt); + trace2_cmd_error_va(fmt, ap); + va_end(ap); } #ifdef SUPPRESS_ANNOTATED_LEAKS |
