1
0
mirror of https://github.com/git/git.git synced 2024-11-18 23:13:58 +01:00

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>
This commit is contained in:
Larry D'Anna 2010-02-15 23:10:45 -05:00 committed by Junio C Hamano
parent 33f0ea42e1
commit 8324b977ae

2
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;