From: Michael Coleman <tutufan@gmail.com>
To: git@vger.kernel.org
Cc: Michael Coleman <tutufan@gmail.com>
Subject: [PATCH] builtin-fmt-merge-msg: fix bugs in --file option
Date: Tue, 27 Feb 2007 23:44:42 -0600 [thread overview]
Message-ID: <1172641482207-git-send-email-tutufan@gmail.com> (raw)
If --file's argument is missing, don't crash. If it cannot be opened,
die with an error message.
---
builtin-fmt-merge-msg.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 1489883..5c145d2 100644
--- a/builtin-fmt-merge-msg.c
+++ b/builtin-fmt-merge-msg.c
@@ -259,13 +259,15 @@ int cmd_fmt_merge_msg(int argc, const char **argv, const char *prefix)
else if (!strcmp(argv[1], "--no-summary"))
merge_summary = 0;
else if (!strcmp(argv[1], "-F") || !strcmp(argv[1], "--file")) {
- if (argc < 2)
+ if (argc < 3)
die ("Which file?");
if (!strcmp(argv[2], "-"))
in = stdin;
else {
fclose(in);
in = fopen(argv[2], "r");
+ if (!in)
+ die("cannot open %s", argv[2]);
}
argc--; argv++;
} else
--
1.5.0.rc3
reply other threads:[~2007-02-28 5:45 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=1172641482207-git-send-email-tutufan@gmail.com \
--to=tutufan@gmail.com \
--cc=git@vger.kernel.org \
/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).