From 1ee821fb634ee2b1674cd7b158c0517e57fd969d Mon Sep 17 00:00:00 2001 From: limeng151 <limeng151@huawei.com> Date: Tue, 29 Jun 2021 14:13:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=B1=E6=9D=83=E9=99=90?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=94=A8=E4=BE=8B=E6=89=A7=E8=A1=8C=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: limeng151 <limeng151@huawei.com> Change-Id: I303461dc760f4d16ee9b76aa3eb193b998a23924 --- kernel_lite/process_posix/src/UidGidTest.cpp | 7 ++----- kernel_lite/process_posix/src/UidGidTest.h | 1 + 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kernel_lite/process_posix/src/UidGidTest.cpp b/kernel_lite/process_posix/src/UidGidTest.cpp index a8fe8d0fd..cde442313 100755 --- a/kernel_lite/process_posix/src/UidGidTest.cpp +++ b/kernel_lite/process_posix/src/UidGidTest.cpp @@ -642,7 +642,6 @@ HWTEST_F(UidGidTest, testGetgroups, Function | MediumTest | Level1) int n = getgroups(0, gidList); ASSERT_EQ(n, 1); ASSERT_EQ(gidList[0], 0); - n = getgroups(testSize, gidList); ASSERT_EQ(n, 1); ASSERT_EQ(gidList[0], SHELL_GID); @@ -691,8 +690,6 @@ HWTEST_F(UidGidTest, testSetgroups1, Function | MediumTest | Level1) n = getgroups(2, gidListOut); EXPECT_EQ(n, 1); EXPECT_EQ(gidListOut[0], SHELL_GID); - gidListOut[0] = 2; - int ret = setgroups(2, gidListOut); free(gidListIn); free(gidListOut); } @@ -708,8 +705,8 @@ HWTEST_F(UidGidTest, testSetgroups2, Function | MediumTest | Level1) gid_t gidListOut[4] = {0}; LOG("Init: make sure groups not changed by other test."); - int n = getgroups(2, gidListOut); - EXPECT_EQ(n, 2); + int n = getgroups(1, gidListOut); + EXPECT_EQ(n, 1); EXPECT_EQ(gidListOut[0], SHELL_GID); LOG("add 2 groups"); diff --git a/kernel_lite/process_posix/src/UidGidTest.h b/kernel_lite/process_posix/src/UidGidTest.h index e2b15bbd7..fc3a11313 100755 --- a/kernel_lite/process_posix/src/UidGidTest.h +++ b/kernel_lite/process_posix/src/UidGidTest.h @@ -61,6 +61,7 @@ protected: setgid(SHELL_GID); AssertAllUid(SHELL_UID); AssertAllGid(SHELL_GID); + int rt = setgroups(0, NULL); } }; -- GitLab