diff options
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r-- | gdb/ser-unix.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index 6c142e7..248496e 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -212,18 +212,23 @@ wait_for(scb, timeout) FD_SET(scb->fd, &readfds); - if (timeout >= 0) - numfds = select(scb->fd+1, &readfds, 0, 0, &tv); - else - numfds = select(scb->fd+1, &readfds, 0, 0, 0); - - if (numfds <= 0) - if (numfds == 0) - return SERIAL_TIMEOUT; - else - return SERIAL_ERROR; /* Got an error from select or poll */ - - return 0; + while (1) + { + if (timeout >= 0) + numfds = select(scb->fd+1, &readfds, 0, 0, &tv); + else + numfds = select(scb->fd+1, &readfds, 0, 0, 0); + + if (numfds <= 0) + if (numfds == 0) + return SERIAL_TIMEOUT; + else if (errno == EINTR) + continue; + else + return SERIAL_ERROR; /* Got an error from select or poll */ + + return 0; + } #endif /* HAVE_SGTTY */ |