git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f)

From
Thomas Rast <trast@student.ethz.ch>
Date
Jun 11, 2010, 15:02 UTC
Message-ID
<769689aa933aa5b0d207e94983328c03db105594.1276268216.git.trast@student.ethz.ch>
In-Reply-To
<AANLkTikIQeY1ZieEkev_zjDSVI9W1NpfhiyTNCaToeys@mail.gmail.com>

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>
---
Erik Faye-Lund wrote:
> Ugh. We don't use the va_copy for portability reasons; it's C99, and
> impossible to implement in a portable way on non-C99 systems.
Ah well, that makes the patch easier to write though more annoying :-)
 fast-import.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index c0728c2..1e5d66e 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -483,12 +483,14 @@ static void dump_marks(void);
 static NORETURN void die_nicely(const char *err, va_list params)
 {
 	static int zombie;
+	char message[2 * PATH_MAX];
 
-	vreportf("fatal: ", err, params);
+	vsnprintf(message, sizeof(message), err, params);
+	fputs("fatal: ", stderr);
+	fputs(message, stderr);
+	fputc('\n', stderr);
 
 	if (!zombie) {
-		char message[2 * PATH_MAX];
-
 		zombie = 1;
 		write_crash_report(message);
 		end_packfile();
-- 
1.7.1.561.g94582
Previous: Erik Faye-Lund
Message 3 of 3 in “fast-import: revert die_nicely() to vsnprintf”
  1. fast-import: revert die_nicely() to vsnprintfThomas Rast, Jun 10, 2010
  2. Erik Faye-LundJun 11, 2010
  3. fast-import: die_nicely() back to vsnprintf (reverts part of ebaa79f)Thomas Rast, Jun 11, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.