rerere.c: move error_errno() closer to the source system call

We are supposed to report errno from fopen(). fclose() between fopen()
and the report function could either change errno or reset it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Nguyễn Thái Ngọc Duy
2017-05-09 17:11:33 +07:00
committed by Junio C Hamano
parent 5118d7f4e6
commit f7566f073f

View File

@ -489,8 +489,9 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
if (output) {
io.io.output = fopen(output, "w");
if (!io.io.output) {
error_errno("Could not write %s", output);
fclose(io.input);
return error_errno("Could not write %s", output);
return -1;
}
}