Pārlūkot izejas kodu

[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 gadi atpakaļ
vecāks
revīzija
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;
 }

BIN
tools/clang/test/CodeGenSPIRV/passthru-ps.Debug.dxil


BIN
tools/clang/test/CodeGenSPIRV/passthru-ps.Release.dxil