Skip to content

Commit

Permalink
Merge pull request google#461 from brb-g:128_procseekend
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 255462850
  • Loading branch information
gvisor-bot committed Jun 27, 2019
2 parents 42e212f + 6f0a7de commit 7188790
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/syscalls/linux/getdents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7188790

Please sign in to comment.