mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Fix MemfdTest_OtherProcessCanOpenFromProcfs.
- Make the body of InForkedProcess async-signal-safe. - Pass the correct path to open(). PiperOrigin-RevId: 241348774 Change-Id: I753dfa36e4fb05521e659c173e3b7db0c7fc159b
This commit is contained in:
@@ -485,10 +485,12 @@ TEST(MemfdTest, CanOpenFromProcfs) {
|
||||
TEST(MemfdTest, OtherProcessCanOpenFromProcfs) {
|
||||
const FileDescriptor memfd =
|
||||
ASSERT_NO_ERRNO_AND_VALUE(MemfdCreate(kMemfdName, MFD_ALLOW_SEALING));
|
||||
pid_t pid = getpid();
|
||||
const auto memfd_path =
|
||||
absl::StrFormat("/proc/%d/fd/%d", getpid(), memfd.get());
|
||||
const auto rest = [&] {
|
||||
ASSERT_NO_ERRNO(
|
||||
Open(absl::StrFormat("/proc/self/%d/%d", pid, memfd.get()), O_RDWR));
|
||||
int fd = open(memfd_path.c_str(), O_RDWR);
|
||||
TEST_PCHECK(fd >= 0);
|
||||
TEST_PCHECK(close(fd) >= 0);
|
||||
};
|
||||
EXPECT_THAT(InForkedProcess(rest), IsPosixErrorOkAndHolds(0));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user