Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Coleman <tutufan@gmail.com>2007-02-28 08:44:42 +0300
committerJunio C Hamano <junkio@cox.net>2007-02-28 09:02:41 +0300
commit163d7b9b8536d206eda7eb0eccb0fc211812346f (patch)
tree3da13237a1d8c01e31c5669a1e24f44c62d610f3 /builtin-fmt-merge-msg.c
parenta91d49cd369ac5fc8e1a17357a975d09cf6c8cb3 (diff)
builtin-fmt-merge-msg: fix bugs in --file option
If --file's argument is missing, don't crash. If it cannot be opened, die with an error message. Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-fmt-merge-msg.c')
-rw-r--r--builtin-fmt-merge-msg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/builtin-fmt-merge-msg.c b/builtin-fmt-merge-msg.c
index 87d3d63ec7..5be6fb4388 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