{"thread":{"id":"25285","subject":"[PATCH] diff: trivial fix for --output file error message","startedAt":"2010-09-29T07:26:23Z","lastAt":"2010-09-29T07:26:23Z","messageCount":1,"participants":["Matthieu Moy"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"152027","messageId":"1285745183-7809-1-git-send-email-Matthieu.Moy@imag.fr","threadId":"25285","inReplyTo":null,"subject":"[PATCH] diff: trivial fix for --output file error message","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2010-09-29T07:26:23Z","receivedAt":"2010-09-29T07:26:23Z","isPatch":true,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Since we use parse_long_opt(), the option argument is either after\n--output=... or in the next command-line argument. optarg is the reliable\nway to access it.\n\nSigned-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>\n---\n\nOn my system, it seems --output file works, probably because the\nargument array is stored as \"--output\\0file\", but we should definitely\nnot rely on that ...\n\n diff.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/diff.c b/diff.c\nindex 276e029..38f5f9c 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -3315,7 +3315,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)\n \telse if ((argcount = parse_long_opt(\"output\", av, &optarg))) {\n \t\toptions->file = fopen(optarg, \"w\");\n \t\tif (!options->file)\n-\t\t\tdie_errno(\"Could not open '%s'\", arg + strlen(\"--output=\"));\n+\t\t\tdie_errno(\"Could not open '%s'\", optarg);\n \t\toptions->close_file = 1;\n \t\treturn argcount;\n \t} else\n-- \n1.7.3.2.g257b5f\n"}]}