git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@imag.fr>
To: git@vger.kernel.org, gitster@pobox.com
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Subject: [PATCH] diff: trivial fix for --output file error message
Date: Wed, 29 Sep 2010 09:26:23 +0200	[thread overview]
Message-ID: <1285745183-7809-1-git-send-email-Matthieu.Moy@imag.fr> (raw)

Since we use parse_long_opt(), the option argument is either after
--output=... or in the next command-line argument. optarg is the reliable
way to access it.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
---

On my system, it seems --output file works, probably because the
argument array is stored as "--output\0file", but we should definitely
not rely on that ...

 diff.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff.c b/diff.c
index 276e029..38f5f9c 100644
--- a/diff.c
+++ b/diff.c
@@ -3315,7 +3315,7 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
 	else if ((argcount = parse_long_opt("output", av, &optarg))) {
 		options->file = fopen(optarg, "w");
 		if (!options->file)
-			die_errno("Could not open '%s'", arg + strlen("--output="));
+			die_errno("Could not open '%s'", optarg);
 		options->close_file = 1;
 		return argcount;
 	} else
-- 
1.7.3.2.g257b5f

                 reply	other threads:[~2010-09-29  7:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1285745183-7809-1-git-send-email-Matthieu.Moy@imag.fr \
    --to=matthieu.moy@imag.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).