From e7258bf939d03ee58cba90ab03a27748aaa5a7c6 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Wed, 16 Apr 2008 07:53:40 +0000 Subject: [PATCH] - To work around a bug in the Roadshow TCP/IP stack (since fixed), the waitselect() function now substitutes a 10 microsecond timeout for a zero length timeout. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15189 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/changes | 3 +++ library/socket_wait_select.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/library/changes b/library/changes index 68dca3f..a2f457b 100644 --- a/library/changes +++ b/library/changes @@ -1,3 +1,6 @@ +- To work around a bug in the Roadshow TCP/IP stack (since fixed), the waitselect() + function now substitutes a 10 microsecond timeout for a zero length timeout. + - isatty() no longer crashes if passed a socket rather than a file. - Rewrote the GetRexxVar()/SetRexxVar() functions (mostly) in 'C', using available diff --git a/library/socket_wait_select.c b/library/socket_wait_select.c index cb6fc5d..9b39750 100644 --- a/library/socket_wait_select.c +++ b/library/socket_wait_select.c @@ -1,5 +1,5 @@ /* - * $Id: socket_wait_select.c,v 1.3 2006-04-10 15:08:10 obarthel Exp $ + * $Id: socket_wait_select.c,v 1.4 2008-04-16 07:53:40 obarthel Exp $ * * :ts=4 * @@ -44,8 +44,22 @@ int waitselect(int num_fds,fd_set *read_fds,fd_set *write_fds,fd_set *except_fds,struct timeval *timeout,unsigned long * signal_mask) { + struct timeval other_timeout; int result; + /* This is a workaround for a bug in the Roadshow TCP/IP stack which has been + fixed long ago: if a signal is received, as given in the 'signal_mask' + parameter, the WaitSelect() function may not detect it if the timeout + is zero. */ + if(signal_mask != NULL && timeout != NULL && timeout->tv_secs == 0 && timeout->tv_micro == 0) + { + /* Substitute a ten microsecond timeout. */ + other_timeout.tv_secs = 0; + other_timeout.tv_micro = 10000; + + timeout = &other_timeout; + } + result = __select(num_fds,read_fds,write_fds,except_fds,timeout,signal_mask); return(result);