Skip to content

Commit 8324b97

Browse files
smoofragitster
authored andcommitted
diff: make sure --output=/bad/path is caught
The return value from fopen wasn't being checked. Signed-off-by: Larry D'Anna <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 33f0ea4 commit 8324b97

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

diff.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2799,6 +2799,8 @@ int diff_opt_parse(struct diff_options *options, const char **av, int ac)
27992799
;
28002800
else if (!prefixcmp(arg, "--output=")) {
28012801
options->file = fopen(arg + strlen("--output="), "w");
2802+
if (!options->file)
2803+
die_errno("Could not open '%s'", arg + strlen("--output="));
28022804
options->close_file = 1;
28032805
} else
28042806
return 0;

0 commit comments

Comments
 (0)