Deflake pty_test_linux.

PiperOrigin-RevId: 314208973
This commit is contained in:
Nicolas Lacasse
2020-06-01 14:55:42 -07:00
committed by gVisor bot
parent 12f74bd6f6
commit 6ef5924725
+6
View File
@@ -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;