Commit 1069ad3c54c9aab24f5d5a3c0a84c0b8a599b251

Edward Thomson 2017-04-03T23:05:53

win32: do not inherit file descriptors

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 4943ce2..874892e 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -440,7 +440,14 @@ GIT_INLINE(int) open_once(
 	DWORD attributes,
 	int osf_flags)
 {
-	HANDLE handle = CreateFileW(path, access, sharing, NULL,
+	SECURITY_ATTRIBUTES security;
+	int fd;
+
+	security.nLength = sizeof(SECURITY_ATTRIBUTES);
+	security.lpSecurityDescriptor = NULL;
+	security.bInheritHandle = 0;
+
+	HANDLE handle = CreateFileW(path, access, sharing, &security,
 		creation_disposition, attributes, 0);
 
 	if (handle == INVALID_HANDLE_VALUE) {