Commit dfa0b65c695c24512a60678587183d95de4c18fa

liyuray 2012-06-21T20:17:54

fix below issues on mingw: 1. compile warning: D:\libgit2.git\src\win32\posix_w32.c: In function 'p_open': D:\libgit2.git\src\win32\posix_w32.c:235:10: warning: 'mode_t' is promoted to 'int' when passed through '...' [enabled by default] D:\libgit2.git\src\win32\posix_w32.c:235:10: note: (so you should pass 'int' not 'mode_t' to 'va_arg') D:\libgit2.git\src\win32\posix_w32.c:235:10: note: if this code is reached, the program will abort 2. test crash. 3. the above two issues are same root cause. please see http://www.eskimo.com/~scs/cclass/int/sx11c.html

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 37956af..4e0150f 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -232,7 +232,7 @@ int p_open(const char *path, int flags, ...)
 		va_list arg_list;
 
 		va_start(arg_list, flags);
-		mode = va_arg(arg_list, mode_t);
+		mode = (mode_t)va_arg(arg_list, int);
 		va_end(arg_list);
 	}