summaryrefslogtreecommitdiffstats
path: root/libcutils
diff options
context:
space:
mode:
authorGeorge Burgess IV <gbiv@google.com>2017-01-25 17:25:57 -0800
committerGeorge Burgess IV <gbiv@google.com>2017-01-25 17:31:43 -0800
commit09175a0264d86b6e0cae9324cd95aef0711ae560 (patch)
tree82c6a0e9033e4ddabd47a39927e47836b9c35b2d /libcutils
parent5b202c43760c5f9d833875dae70ac119a5416e97 (diff)
downloadcore-09175a0264d86b6e0cae9324cd95aef0711ae560.tar.gz
core-09175a0264d86b6e0cae9324cd95aef0711ae560.tar.bz2
core-09175a0264d86b6e0cae9324cd95aef0711ae560.zip
Add mode bits to a call to open with O_CREAT
Open with O_CREAT needs mode bits: https://linux.die.net/man/3/open Found by running clang FORTIFY over AOSP. Bug: 32073964 Test: Now builds with clang FORTIFY. Change-Id: Iee4c93c5482f510e0adf8104c27e394b5d87ec88
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/fs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libcutils/fs.c b/libcutils/fs.c
index 488fdfc28..b253b1cd9 100644
--- a/libcutils/fs.c
+++ b/libcutils/fs.c
@@ -80,7 +80,7 @@ static int fs_prepare_path_impl(const char* path, mode_t mode, uid_t uid, gid_t
create:
create_result = prepare_as_dir
? TEMP_FAILURE_RETRY(mkdir(path, mode))
- : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY));
+ : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY, 0644));
if (create_result == -1) {
if (errno != EEXIST) {
ALOGE("Failed to %s(%s): %s",