From 151ea52cf68e4f9716c985b6ee0b2bf2f160f6ef Mon Sep 17 00:00:00 2001 From: George Burgess IV Date: Fri, 3 Feb 2017 14:45:47 -0800 Subject: [PATCH] Add permission bits to open with O_CREAT. It's an error to pass open O_CREAT without giving it mode bits: https://linux.die.net/man/3/open Bug: 32073964 Test: Compiles with clang FORTIFY. Change-Id: Iaa78c3003ed960e1ffe7e56623dba33db4e17443 --- storaged/tests/storaged_test.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storaged/tests/storaged_test.cpp b/storaged/tests/storaged_test.cpp index 5395b9a41..9e03c5018 100644 --- a/storaged/tests/storaged_test.cpp +++ b/storaged/tests/storaged_test.cpp @@ -33,7 +33,7 @@ static void pause(uint32_t sec) { const char* path = "/cache/test"; - int fd = open(path, O_WRONLY | O_CREAT); + int fd = open(path, O_WRONLY | O_CREAT, 0600); ASSERT_LT(-1, fd); char buffer[2048]; memset(buffer, 1, sizeof(buffer));