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>
Nguyễn Thái Ngọc Duy committed
May 9, 2017 at 17:11 UTC
f7566f073fccafdd9e0ace514b25897dd55d217a
1 file changed
+2
-1
rerere.c
+2
-1
@@ -489,8 +489,9 @@ static int handle_file(const char *path, unsigned char *sha1, const char *output
489
if (output) {
490
io.io.output = fopen(output, "w");
491
if (!io.io.output) {
492
+ error_errno("Could not write %s", output);
493
fclose(io.input);
493
- return error_errno("Could not write %s", output);
494
+ return -1;
495
}
496
}
497