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: I6b2a3694f85565afdeb782585c6af36e8c4d1557
This commit is contained in:
George Burgess IV 2017-02-08 23:40:34 -08:00
parent 23f4e6b0a5
commit d6f2e69624

View file

@ -31,7 +31,7 @@ namespace fuse {
constexpr char kTempFile[] = "/data/local/tmp/appfuse_test_dump";
void OpenTempFile(android::base::unique_fd* fd) {
fd->reset(open(kTempFile, O_CREAT | O_RDWR));
fd->reset(open(kTempFile, O_CREAT | O_RDWR, 0600));
ASSERT_NE(-1, *fd) << strerror(errno);
unlink(kTempFile);
ASSERT_NE(-1, *fd) << strerror(errno);