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

Commit 4e4a34bc authored by George Burgess IV's avatar George Burgess IV
Browse files

Remove useless open modes

Open modes are ignored if the user doesn't want the file to be created:
http://man7.org/linux/man-pages/man2/open.2.html

Since it's somewhat misleading/potentially indicative of a missing
O_CREAT/O_TMPFILE, we plan to issue a warning on open calls with useless
mode bits in the near future. Because -Werror is used in this project
(thank you!), we need to either make these modes useful, or remove them.

Bug: 64132680
Test: mma. New warnings no longer appear.
Change-Id: I5d9b98152e48135ea716592b28c5c771cc74018b
parent 97e9c59c
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -122,7 +122,7 @@ status_t FileSection::Execute(ReportRequestSet* requests) const {


    // read from mFilename and pump buffer to incident_helper
    // read from mFilename and pump buffer to incident_helper
    status_t err = NO_ERROR;
    status_t err = NO_ERROR;
    int fd = open(mFilename, O_RDONLY, 0444);
    int fd = open(mFilename, O_RDONLY);
    if (fd == -1) {
    if (fd == -1) {
       ALOGW("FileSection '%s' failed to open file", this->name.string());
       ALOGW("FileSection '%s' failed to open file", this->name.string());
       return -errno;
       return -errno;
+1 −1
Original line number Original line Diff line number Diff line
@@ -201,7 +201,7 @@ TEST_F(FdBufferTest, ReadInStreamEmpty) {


TEST_F(FdBufferTest, ReadInStreamMoreThan4MB) {
TEST_F(FdBufferTest, ReadInStreamMoreThan4MB) {
    const std::string testFile = kTestDataPath + "morethan4MB.txt";
    const std::string testFile = kTestDataPath + "morethan4MB.txt";
    int fd = open(testFile.c_str(), O_RDONLY, 0444);
    int fd = open(testFile.c_str(), O_RDONLY);
    ASSERT_NE(fd, -1);
    ASSERT_NE(fd, -1);
    int pid = fork();
    int pid = fork();
    ASSERT_TRUE(pid != -1);
    ASSERT_TRUE(pid != -1);