Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6f2e696 authored by George Burgess IV's avatar George Burgess IV
Browse files

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
parent 23f4e6b0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);