From: Larry D'Anna Date: Tue, 16 Feb 2010 04:10:45 GMT Subject: [PATCH 1/2] bugfix: segfault on git diff --output=/bad/path Message-ID: <1266293446-8092-1-git-send-email-larry@elder-gods.org> The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna --- diff.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/diff.c b/diff.c index 381cc8d..68def6c 100644 --- a/diff.c +++ b/diff.c @@ -2893,6 +2893,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; -- 1.7.0.rc2.40.g7d8aa