瀏覽代碼

[linux-port] Set correct permissions on new files (#1388)

The previous implementation of CreateFileW for Unix didn't set any permission
flags for the new files it created. This sets the default file
permissions granting read and write permissions to the owner and
read permissions to everyone else. This perpetuates the behavior
before the offending change.

Also adds a few simple smoke tests to verify the code produced by
dxc as well as file creation behavior and other basic smoke-level
functionality of dxc.
Ehsan 7 年之前
父節點
當前提交
d920192496

+ 1 - 1
lib/DxcSupport/WinFunctions.cpp

@@ -132,7 +132,7 @@ HANDLE CreateFileW(_In_ LPCWSTR lpFileName, _In_ DWORD dwDesiredAccess,
   assert(dwFlagsAndAttributes == FILE_ATTRIBUTE_NORMAL &&
          "Attributes other than NORMAL not supported in CreateFileW yet");
 
-  fd = open(pUtf8FileName, flags);
+  fd = open(pUtf8FileName, flags, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
 
   return (HANDLE)fd;
 }

二進制
tools/clang/test/CodeGenSPIRV/passthru-ps.Debug.dxil


二進制
tools/clang/test/CodeGenSPIRV/passthru-ps.Release.dxil