From 3b57dd815f7fbe69b330410e8456633cfe209438 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Wed, 24 May 2023 08:04:00 -0700 Subject: [PATCH] [pty_test] Test that poll() actually sets the POLLIN flag in PollAndReadFd PiperOrigin-RevId: 534841961 --- test/syscalls/linux/pty.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc index 28abbea99..f2dc04440 100644 --- a/test/syscalls/linux/pty.cc +++ b/test/syscalls/linux/pty.cc @@ -374,6 +374,8 @@ PosixErrorOr PollAndReadFd(int fd, void* buf, size_t count, continue; } return PosixError(errno, "read failed"); + } else if (n > 0 && (pfd.revents & POLLIN) == 0) { + return PosixError(EINVAL, "Poll said not readable but data was read"); } completed += n; if (completed >= count) {