diff: make sure --output=/bad/path is caught
The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna <larry@elder-gods.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Larry D'Anna committed
Feb 15, 2010 at 23:10 UTC
8324b977aef3d2301f170e23f498b50e11302575
1 file changed
+2
diff.c
+2
@@ -2799,6 +2799,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
2799
;
2800
else if (!prefixcmp(arg, "--output=")) {
2801
options->file = fopen(arg + strlen("--output="), "w");
2802
+ if (!options->file)
2803
+ die_errno("Could not open '%s'", arg + strlen("--output="));
2804
options->close_file = 1;
2805
} else
2806
return 0;