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

[PATCH] fast-export: don't segfault when marks file cannot be opened

From
Sverre Rabbelier <srabbelier@gmail.com>
Date
Mar 28, 2010, 05:42 UTC
Message-ID
<1269754968-24961-1-git-send-email-srabbelier@gmail.com>

The error function only prints an error message, resulting in a segfault if we later on try to fprintf to a NULL handle.

Fix this by using die_errno instead.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
---
  This has been proken ever since this functionality was added in
  df6a7ff7 (add importing and exporting of revision marks) on
  Jun 11 2008 by Pieter de Bie (cc-ed). All other error calls
  seem to be appropriate.
  This should probably be applied to maint?
 builtin/fast-export.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/fast-export.c b/builtin/fast-export.c
index b0a4029..963e89b 100644
--- a/builtin/fast-export.c
+++ b/builtin/fast-export.c
@@ -503,7 +503,7 @@ static void export_marks(char *file)
 
 	f = fopen(file, "w");
 	if (!f)
-		error("Unable to open marks file %s for writing.", file);
+		die_errno("Unable to open marks file %s for writing", file);
 
 	for (i = 0; i < idnums.size; i++) {
 		if (deco->base && deco->base->type == 1) {
-- 
1.7.0.2.333.g70ce.dirty
Next: Sverre Rabbelier
Message 1 of 3 in “fast-export: don't segfault when marks file cannot be opened”
  1. fast-export: don't segfault when marks file cannot be openedSverre Rabbelier, Mar 28, 2010
  2. Sverre RabbelierMar 28, 2010
  3. Junio C HamanoMar 28, 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.