From 8324b977aef3d2301f170e23f498b50e11302575 Mon Sep 17 00:00:00 2001 From: Larry D'Anna Date: Mon, 15 Feb 2010 23:10:45 -0500 Subject: [PATCH] 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.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.26.2