diff --git a/diff.c b/diff.c index 17a2b4df29..8d8405aba2 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;