{"thread":{"id":"23212","subject":"[PATCH] fast-export: don't segfault when marks file cannot be opened","startedAt":"2010-03-28T05:42:48Z","lastAt":"2010-03-28T16:26:50Z","messageCount":3,"participants":["Sverre Rabbelier","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"137993","messageId":"1269754968-24961-1-git-send-email-srabbelier@gmail.com","threadId":"23212","inReplyTo":null,"subject":"[PATCH] fast-export: don't segfault when marks file cannot be opened","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-28T05:42:48Z","receivedAt":"2010-03-28T05:42:48Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"The error function only prints an error message, resulting in a\nsegfault if we later on try to fprintf to a NULL handle.\n\nFix this by using die_errno instead.\n\nSigned-off-by: Sverre Rabbelier <srabbelier@gmail.com>\n---\n\n  This has been proken ever since this functionality was added in\n  df6a7ff7 (add importing and exporting of revision marks) on\n  Jun 11 2008 by Pieter de Bie (cc-ed). All other error calls\n  seem to be appropriate.\n\n  This should probably be applied to maint?\n\n builtin/fast-export.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin/fast-export.c b/builtin/fast-export.c\nindex b0a4029..963e89b 100644\n--- a/builtin/fast-export.c\n+++ b/builtin/fast-export.c\n@@ -503,7 +503,7 @@ static void export_marks(char *file)\n \n \tf = fopen(file, \"w\");\n \tif (!f)\n-\t\terror(\"Unable to open marks file %s for writing.\", file);\n+\t\tdie_errno(\"Unable to open marks file %s for writing\", file);\n \n \tfor (i = 0; i < idnums.size; i++) {\n \t\tif (deco->base && deco->base->type == 1) {\n-- \n1.7.0.2.333.g70ce.dirty\n"},{"id":"137994","messageId":"fabb9a1e1003272245gc1de70ar216997ca11bc2038@mail.gmail.com","threadId":"23212","inReplyTo":"1269754968-24961-1-git-send-email-srabbelier@gmail.com","subject":"Re: [PATCH] fast-export: don't segfault when marks file cannot be opened","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-03-28T05:45:18Z","receivedAt":"2010-03-28T05:45:18Z","isPatch":true,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\nOn Sat, Mar 27, 2010 at 23:42, Sverre Rabbelier <srabbelier@gmail.com> wrote:\n> -               error(\"Unable to open marks file %s for writing.\", file);\n> +               die_errno(\"Unable to open marks file %s for writing\", file);\n\nHeh, and of course I manage to mess up a 3-byte patch. The '.' removal\nshouldn't be there of course.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"138012","messageId":"7v7how5s51.fsf@alter.siamese.dyndns.org","threadId":"23212","inReplyTo":"fabb9a1e1003272245gc1de70ar216997ca11bc2038@mail.gmail.com","subject":"Re: [PATCH] fast-export: don't segfault when marks file cannot be opened","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-28T16:26:50Z","receivedAt":"2010-03-28T16:26:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sverre Rabbelier <srabbelier@gmail.com> writes:\n\n> Heh, and of course I manage to mess up a 3-byte patch. The '.' removal\n> shouldn't be there of course.\n\nWill fix it up here.  Thanks.\n"}]}