Commit f5254d78441f7fa1067a1c34d3925b72afcb024c

Sven Strickroth 2013-07-27T20:15:06

Fix possible double close Signed-off-by: Sven Strickroth <email@cs-ware.de>

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/src/fileops.c b/src/fileops.c
index c01ff64..7f8418d 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -222,6 +222,7 @@ int git_futils_writebuffer(
 	if ((error = p_write(fd, git_buf_cstr(buf), git_buf_len(buf))) < 0) {
 		giterr_set(GITERR_OS, "Could not write to '%s'", path);
 		(void)p_close(fd);
+		return error;
 	}
 
 	if ((error = p_close(fd)) < 0)