summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-08-20 23:38:14 -0400
committerJunio C Hamano <gitster@pobox.com>2007-08-20 21:57:50 -0700
commit4bf53833dbca666f61b5177977e96d453527db20 (patch)
treea3911c9c47d8ab538266e0135dafad063c0826e0 /fast-import.c
parent23d53358be51bb256699f4d237619a3ee8addf39 (diff)
downloadgit-4bf53833dbca666f61b5177977e96d453527db20.tar.gz
Avoid using va_copy in fast-import: it seems to be unportable.
[sp: minor change to use fputs, thus reducing the patch size] Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/fast-import.c b/fast-import.c
index 2d5224c186..078079d404 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -375,7 +375,7 @@ static void write_branch_report(FILE *rpt, struct branch *b)
fputc('\n', rpt);
}
-static void write_crash_report(const char *err, va_list params)
+static void write_crash_report(const char *err)
{
char *loc = git_path("fast_import_crash_%d", getpid());
FILE *rpt = fopen(loc, "w");
@@ -397,7 +397,7 @@ static void write_crash_report(const char *err, va_list params)
fputc('\n', rpt);
fputs("fatal: ", rpt);
- vfprintf(rpt, err, params);
+ fputs(err, rpt);
fputc('\n', rpt);
fputc('\n', rpt);
@@ -442,18 +442,17 @@ static void write_crash_report(const char *err, va_list params)
static NORETURN void die_nicely(const char *err, va_list params)
{
static int zombie;
- va_list x_params;
+ char message[2 * PATH_MAX];
- va_copy(x_params, params);
+ vsnprintf(message, sizeof(message), err, params);
fputs("fatal: ", stderr);
- vfprintf(stderr, err, params);
+ fputs(message, stderr);
fputc('\n', stderr);
if (!zombie) {
zombie = 1;
- write_crash_report(err, x_params);
+ write_crash_report(message);
}
- va_end(x_params);
exit(128);
}