Implement controls for file descriptor inheritance
[libs/core.git] / source / io / windows / file.cpp
index b973375475abe3554296969bb5a19ed836fbbe2f..f6943adb3cb397cf3be67c8f76f4a9989cd9a2d2 100644 (file)
@@ -33,6 +33,11 @@ void File::platform_init(const string &fn, CreateMode cm)
        else
                share_flags = FILE_SHARE_READ;
 
+       SECURITY_ATTRIBUTES sec_attr;
+       sec_attr.nLength = sizeof(SECURITY_ATTRIBUTES);
+       sec_attr.lpSecurityDescriptor = 0;
+       sec_attr.bInheritHandle = !!(mode&M_INHERIT);
+
        *handle = CreateFile(fn.c_str(), flags, share_flags, 0, create_flags, FILE_ATTRIBUTE_NORMAL, 0);
        if(!handle)
        {