mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix chown test.
PiperOrigin-RevId: 345265342
This commit is contained in:
committed by
gVisor bot
parent
b11f40db1e
commit
7ccb0b6a7c
@@ -75,7 +75,16 @@ TEST_P(ChownParamTest, ChownFileSucceeds) {
|
||||
if (num_groups > 0) {
|
||||
std::vector<gid_t> list(num_groups);
|
||||
EXPECT_THAT(getgroups(list.size(), list.data()), SyscallSucceeds());
|
||||
gid = list[0];
|
||||
// Scan the list of groups for a valid gid. Note that if a group is not
|
||||
// defined in this local user namespace, then we will see 65534, and the
|
||||
// group will not chown below as expected. So only change if we find a
|
||||
// valid group in this list.
|
||||
for (const gid_t other_gid : list) {
|
||||
if (other_gid != 65534) {
|
||||
gid = other_gid;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
EXPECT_NO_ERRNO(GetParam()(file.path(), geteuid(), gid));
|
||||
|
||||
Reference in New Issue
Block a user