Skip to content

Commit

Permalink
diff: make sure --output=/bad/path is caught
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Larry D'Anna authored and Junio C Hamano committed Feb 16, 2010
1 parent 33f0ea4 commit 8324b97
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 8324b97

Please sign in to comment.