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