summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLarry D'Anna <larry@elder-gods.org>2010-02-16 04:10:45 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-02-16 05:46:01 (GMT)
commit8324b977aef3d2301f170e23f498b50e11302575 (patch)
treec8a923851921f2f2efd50094deb9235afa966e8a
parent33f0ea42e12d3f54ef8ff53580649885c1503d05 (diff)
downloadgit-8324b977aef3d2301f170e23f498b50e11302575.zip
git-8324b977aef3d2301f170e23f498b50e11302575.tar.gz
git-8324b977aef3d2301f170e23f498b50e11302575.tar.bz2
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>
-rw-r--r--diff.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/diff.c b/diff.c
index 17a2b4d..8d8405a 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;