summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalin Juravle <calin@google.com>2019-05-23 13:14:35 -0700
committerKevin F. Haggerty <haggertk@lineageos.org>2019-08-06 06:46:06 -0600
commit14e6dd3f806deebb794c1d7eaba0ad8aac663444 (patch)
tree7546f877f8bca0d853fce29f411493cebf0d67fb
parent6a1401ba3d076a65e8ab013560f7fc51f8301278 (diff)
downloadart-lineage-15.1.tar.gz
art-lineage-15.1.tar.bz2
art-lineage-15.1.zip
Use conservative permissions when creating files in ARTlineage-15.1
Use 644 permissions by default so that only the owner has write-rights. Bug: 130821293 Test: host run-test & gtest Merged-In: I09eab9749d1ce5872ecaf7d5a80fc45c9c708853 Change-Id: Ic4dae399a5bfe862aff3d8614c45b38044d805db (cherry picked from commit d224e964bd0de231c72008547b0246a2f70048ee)
-rw-r--r--runtime/os_linux.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/os_linux.cc b/runtime/os_linux.cc
index 0add4965d1..ae86a2f5b1 100644
--- a/runtime/os_linux.cc
+++ b/runtime/os_linux.cc
@@ -55,7 +55,8 @@ File* OS::OpenFileWithFlags(const char* name, int flags, bool auto_flush) {
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;
}