OSDN Git Service

Use conservative permissions when creating files in ART
authorCalin Juravle <calin@google.com>
Thu, 23 May 2019 20:14:35 +0000 (13:14 -0700)
committerNikoli Cartagena <dargeren@google.com>
Mon, 10 Jun 2019 18:35:23 +0000 (11:35 -0700)
Use 644 permissions by default so that only the owner has write-rights.

Bug: 130821293
Test: host run-test & gtest
Merged-In: Ic4dae399a5bfe862aff3d8614c45b38044d805db
Merged-In: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853
Change-Id: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853
(cherry picked from commit e69642936ef28e09970e8a3abb36f31e3d7d17bf)

runtime/os_linux.cc

index f45e9f6..b628846 100644 (file)
@@ -54,7 +54,7 @@ File* OS::CreateEmptyFileWriteOnly(const char* name) {
 File* OS::OpenFileWithFlags(const char* name, int flags) {
   CHECK(name != nullptr);
   std::unique_ptr<File> file(new File);
-  if (!file->Open(name, flags, 0666)) {
+  if (!file->Open(name, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) {
     return nullptr;
   }
   return file.release();