diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-06-27 13:48:08 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-06-27 13:58:14 -0700 |
commit | 7188790f92444e3e817a62606745ecc05cb181a5 (patch) | |
tree | 920f9051af09414c81328a7a07df8334efae8987 /test | |
parent | 42e212f6b7d4f6dd70e9751562f1524231e39a0e (diff) | |
parent | 6f0a7de44b45bd76022dfdf7b0a1388e581c205c (diff) |
Merge pull request #461 from brb-g:128_procseekend
PiperOrigin-RevId: 255462850
Diffstat (limited to 'test')
-rw-r--r-- | test/syscalls/linux/getdents.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/syscalls/linux/getdents.cc b/test/syscalls/linux/getdents.cc index d146c8db7..565d6fb36 100644 --- a/test/syscalls/linux/getdents.cc +++ b/test/syscalls/linux/getdents.cc @@ -437,6 +437,19 @@ TYPED_TEST(GetdentsTest, SeekResetsCursor) { EXPECT_EQ(expect, this->ReadAndCountAllEntries(&dirents)); } +// Test that getdents() after SEEK_END succeeds. +// This is a regression test for #128. +TYPED_TEST(GetdentsTest, Issue128ProcSeekEnd) { + auto fd = + ASSERT_NO_ERRNO_AND_VALUE(Open("/proc/self", O_RDONLY | O_DIRECTORY)); + typename TestFixture::DirentBufferType dirents(256); + + ASSERT_THAT(lseek(fd.get(), 0, SEEK_END), SyscallSucceeds()); + ASSERT_THAT(RetryEINTR(syscall)(this->SyscallNum(), fd.get(), dirents.Data(), + dirents.Size()), + SyscallSucceeds()); +} + // Some tests using the glibc readdir interface. TEST(ReaddirTest, OpenDir) { DIR* dev; |