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

Commit 6d24dd59 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fixed RunCommandDropRoot when running as Shell."

parents 54c66836 26c4157a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -319,7 +319,7 @@ TEST_F(DumpstateTest, RunCommandDropRoot) {
    EXPECT_EQ(0, RunCommand("", {simpleCommand, "--uid"},
                            CommandOptions::WithTimeout(1).DropRoot().Build()));
    EXPECT_THAT(out, StrEq("2000\nstdout\n"));
    EXPECT_THAT(err, StrEq("stderr\n"));
    EXPECT_THAT(err, StrEq("drop_root_user(): already running as Shell\nstderr\n"));
}

TEST_F(DumpstateTest, RunCommandAsRootUserBuild) {
+1 −1
Original line number Diff line number Diff line
@@ -937,7 +937,7 @@ void Dumpstate::RunDumpsys(const std::string& title, const std::vector<std::stri

bool drop_root_user() {
    if (getgid() == AID_SHELL && getuid() == AID_SHELL) {
        MYLOGD("drop_root_user(): already running as Shell");
        MYLOGD("drop_root_user(): already running as Shell\n");
        return true;
    }
    /* ensure we will keep capabilities when we drop root */