Fix perms on diagnostic files (#57177)
authorJuan Hoyos <juan.hoyos@microsoft.com>
Wed, 11 Aug 2021 02:40:09 +0000 (19:40 -0700)
committerGitHub <noreply@github.com>
Wed, 11 Aug 2021 02:40:09 +0000 (02:40 +0000)
src/coreclr/debug/createdump/crashreportwriter.cpp
src/coreclr/debug/createdump/dumpwriter.cpp

index 23dd7c28d6ea999493ac434ea0053c4ed8e4b80f..e72651e4f824bec77a53c8a2266372fe562336a7 100644 (file)
@@ -199,7 +199,7 @@ CrashReportWriter::WriteSysctl(const char* sysctlname, const char* valueName)
 
 void
 CrashReportWriter::WriteStackFrame(const StackFrame& frame)
-{ 
+{
     OpenObject();
     WriteValueBool("is_managed", frame.IsManaged());
     WriteValue64("module_address", frame.ModuleAddress());
@@ -252,7 +252,7 @@ CrashReportWriter::WriteStackFrame(const StackFrame& frame)
 bool
 CrashReportWriter::OpenWriter(const char* fileName)
 {
-    m_fd = open(fileName, O_WRONLY|O_CREAT|O_TRUNC, 0664);
+    m_fd = open(fileName, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR | S_IRUSR);
     if (m_fd == -1)
     {
         fprintf(stderr, "Could not create json file %s: %d %s\n", fileName, errno, strerror(errno));
index f4532a58ca90268603ef119dbaaf9967ad69530c..4aa46ac36814442f09e47f4f4ed61856362fe7a9 100644 (file)
@@ -23,7 +23,7 @@ DumpWriter::~DumpWriter()
 bool
 DumpWriter::OpenDump(const char* dumpFileName)
 {
-    m_fd = open(dumpFileName, O_WRONLY|O_CREAT|O_TRUNC, 0664);
+    m_fd = open(dumpFileName, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR | S_IRUSR);
     if (m_fd == -1)
     {
         fprintf(stderr, "Could not open output %s: %d %s\n", dumpFileName, errno, strerror(errno));