fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f)
ebaa79f (Make report() from usage.c public as vreportf() and use it., 2010-03-06) changed fast-import's die_nicely() to use vreportf(). Unfortunately this is not possible: we need the message again for write_report(), and vreportf() uses vsnprintf(), which invalidates the va_list. As pointed out by Erik Faye-Lund, va_copy is C99 and thus not an option. So revert the part of ebaa79f that pertains to die_nicely(). Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Rast committed
Jun 11, 2010 at 17:02 UTC
3e333036ccbb97fddf54bd8fe74b12ba46f1687b
1 file changed
+5
-3
fast-import.c
+5
-3
@@ -483,12 +483,14 @@ static void dump_marks(void);
483
static NORETURN void die_nicely(const char *err, va_list params)
484
{
485
static int zombie;
486
+ char message[2 * PATH_MAX];
487
487
- vreportf("fatal: ", err, params);
488
+ vsnprintf(message, sizeof(message), err, params);
489
+ fputs("fatal: ", stderr);
490
+ fputs(message, stderr);
491
+ fputc('\n', stderr);
492
493
if (!zombie) {
490
- char message[2 * PATH_MAX];
491
-
494
zombie = 1;
495
write_crash_report(message);
496
end_packfile();