]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
David Laight reports that sometimes reads on a serial port will
authorSimon Tatham <anakin@pobox.com>
Sat, 6 Nov 2010 17:22:38 +0000 (17:22 +0000)
committerSimon Tatham <anakin@pobox.com>
Sat, 6 Nov 2010 17:22:38 +0000 (17:22 +0000)
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

index 92961a7de9928c5bcc7972d524e6cc8785c9820c..22f4a0654e3859ba6c5c0c0294f31e1df65357f7 100644 (file)
@@ -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) {