From: Larry D'Anna Date: Tue, 16 Feb 2010 04:10:45 +0000 (-0500) Subject: diff: make sure --output=/bad/path is caught X-Git-Tag: v1.7.0.1~3^2~1^2~2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=8324b977aef3d2301f170e23f498b50e11302575;p=git.git diff: make sure --output=/bad/path is caught The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna Signed-off-by: Junio C Hamano --- diff --git a/diff.c b/diff.c index 17a2b4df2..8d8405aba 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;