Thread (25 messages) flat view 25 messages, 7 authors, 2017-05-30
STALE3402d

[PATCH v3 10/13] rerere.c: move error_errno() closer to the source system call

From: Junio C Hamano <hidden>
Date: 2017-05-26 03:35:43
Subsystem: the rest · Maintainer: Linus Torvalds

From: Nguyễn Thái Ngọc Duy <redacted>

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 <redacted>
---
 rerere.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/rerere.c b/rerere.c
index 1351b0c3fb..c26c29f87a 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;
 		}
 	}
 
-- 
2.13.0-491-g71cfeddc25
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help