summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorLarry D'Anna <larry@elder-gods.org>2010-02-15 23:10:45 -0500
committerJunio C Hamano <gitster@pobox.com>2010-02-15 21:46:01 -0800
commit8324b977aef3d2301f170e23f498b50e11302575 (patch)
treec8a923851921f2f2efd50094deb9235afa966e8a /diff.c
parent33f0ea42e12d3f54ef8ff53580649885c1503d05 (diff)
downloadgit-8324b977aef3d2301f170e23f498b50e11302575.tar.gz
diff: make sure --output=/bad/path is caught
The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna <larry@elder-gods.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 17a2b4df29..8d8405aba2 100644
--- a/diff.c
+++ b/diff.c
@@ -2799,6 +2799,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
;
else if (!prefixcmp(arg, "--output=")) {
options->file = fopen(arg + strlen("--output="), "w");
+ if (!options->file)
+ die_errno("Could not open '%s'", arg + strlen("--output="));
options->close_file = 1;
} else
return 0;