From: Nguyễn Thái Ngọc Duy Date: Tue, 9 May 2017 10:11:33 +0000 (+0700) Subject: rerere.c: move error_errno() closer to the source system call X-Git-Tag: v2.14.0-rc0~82^2~4 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=f7566f073fccafdd9e0ace514b25897dd55d217a;p=git-core%2Fgit.git 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 --- diff --git a/rerere.c b/rerere.c index 1351b0c3f..c26c29f87 100644 --- a/rerere.c +++ b/rerere.c @@ -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; } }