Skip to contentSkip to conversation

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

PATCH In review Sverre Rabbelier 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fast-export: don't segfault when marks file cannot be opened

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.

---

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(-)
builtin/fast-export.c +1 -1
index b0a4029..963e89b 100644
@@ -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) {
Signature · 1 line
1.7.0.2.333.g70ce.dirty
#1 lore raw

Heya,

Quoted 2 lines · Sverre Rabbelier

-               error("Unable to open marks file %s for writing.", file);
+               die_errno("Unable to open marks file %s for writing", file);

Heh, and of course I manage to mess up a 3-byte patch. The '.' removal shouldn't be there of course.

Signature · 3 lines
Cheers,

Sverre Rabbelier
#2 lore raw
Quoted 2 lines · Sverre Rabbelier

Heh, and of course I manage to mess up a 3-byte patch. The '.' removal shouldn't be there of course.

Will fix it up here. Thanks.