summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/pty.cc
diff options
context:
space:
mode:
authorNicolas Lacasse <nlacasse@google.com>2020-06-01 14:54:09 -0700
committergVisor bot <gvisor-bot@google.com>2020-06-01 14:55:42 -0700
commit6ef5924725812f5885880cf57821fe2cd49b808d (patch)
tree79a3bdcc25dbf78b346f4e2661afdc1650c4c608 /test/syscalls/linux/pty.cc
parent12f74bd6f6208f87c857da4adddeb0c32f15e893 (diff)
Deflake pty_test_linux.
PiperOrigin-RevId: 314208973
Diffstat (limited to 'test/syscalls/linux/pty.cc')
-rw-r--r--test/syscalls/linux/pty.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/syscalls/linux/pty.cc b/test/syscalls/linux/pty.cc
index b8a0159ba..aabfa6955 100644
--- a/test/syscalls/linux/pty.cc
+++ b/test/syscalls/linux/pty.cc
@@ -364,6 +364,12 @@ PosixErrorOr<size_t> PollAndReadFd(int fd, void* buf, size_t count,
ssize_t n =
ReadFd(fd, static_cast<char*>(buf) + completed, count - completed);
if (n < 0) {
+ if (errno == EAGAIN) {
+ // Linux sometimes returns EAGAIN from this read, despite the fact that
+ // poll returned success. Let's just do what do as we are told and try
+ // again.
+ continue;
+ }
return PosixError(errno, "read failed");
}
completed += n;