From 0fc1f786779d00c3db3a0e9bb40bbf476b57af67 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 6 Nov 2010 17:22:38 +0000 Subject: [PATCH] David Laight reports that sometimes reads on a serial port will attempt to block, and hence return EAGAIN/EWOULDBLOCK, in spite of the port having been reported readable by select(2). Don't treat those errors as fatal. [originally from svn r9020] --- unix/uxser.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/unix/uxser.c b/unix/uxser.c index 92961a7d..22f4a065 100644 --- a/unix/uxser.c +++ b/unix/uxser.c @@ -342,6 +342,14 @@ static int serial_select_result(int fd, int event) */ finished = TRUE; } else if (ret < 0) { +#ifdef EAGAIN + if (errno == EAGAIN) + return 1; /* spurious */ +#endif +#ifdef EWOULDBLOCK + if (errno == EWOULDBLOCK) + return 1; /* spurious */ +#endif perror("read serial port"); exit(1); } else if (ret > 0) { -- 2.45.2