* remote.c: Add arg names to prototypes, in a modest effort at
clarification. Also add prototypes for some new functions. * (remote_wait): Better error reporting for 'T' responses. * ser-go32.c (strncasecmp): Make str1 & str2 be const. * (dos_async_init): Make usage message reflect requested port #. * ser-tcp.c (tcp_open): Terminate hostname properly to prevent random hostname lookup failures. Add nicer message for unknown host error. (wait_for): Wake up in case of exceptions. Also, restart select() if we got EINTR. * ser-unix.c (wait_for): Restart select() if we got EINTR. * serial.c: (serial_close): Clean up code.
This commit is contained in:
parent
2685ead7d6
commit
a037b21e75
5 changed files with 67 additions and 36 deletions
|
@ -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);
|
||||
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
|
||||
return SERIAL_ERROR; /* Got an error from select or poll */
|
||||
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;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SGTTY */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue