Use conservative permissions when creating files in ART
Use 644 permissions by default so that only the owner has write-rights.
Bug: 130821293
Test: host run-test & gtest
Change-Id: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853
diff --git a/libartbase/base/os_linux.cc b/libartbase/base/os_linux.cc
index a00779e..337c54f 100644
--- a/libartbase/base/os_linux.cc
+++ b/libartbase/base/os_linux.cc
@@ -62,7 +62,8 @@
CHECK(name != nullptr);
bool read_only = ((flags & O_ACCMODE) == O_RDONLY);
bool check_usage = !read_only && auto_flush;
- std::unique_ptr<File> file(new File(name, flags, 0666, check_usage));
+ std::unique_ptr<File> file(
+ new File(name, flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, check_usage));
if (!file->IsOpened()) {
return nullptr;
}