diff options
| author | Stef Walter <stef@memberwebs.com> | 2004-09-23 16:32:08 +0000 | 
|---|---|---|
| committer | Stef Walter <stef@memberwebs.com> | 2004-09-23 16:32:08 +0000 | 
| commit | 8d395740534a6a10aca946e0a179127b8c944718 (patch) | |
| tree | c7644359f89b2f10f02cdf5f1437a58fc641aa2f | |
| parent | 21abfc85b0e8afcbb4e1397e1a11564336fedc71 (diff) | |
Fix problems with select zeroing out timeouts.
| -rw-r--r-- | common/spio.c | 7 | 
1 files changed, 5 insertions, 2 deletions
| diff --git a/common/spio.c b/common/spio.c index 91e2da0..67d32b1 100644 --- a/common/spio.c +++ b/common/spio.c @@ -169,6 +169,7 @@ unsigned int spio_select(spctx_t* ctx, ...)      int have = 0;      int i = 0;      va_list ap; +    struct timeval timeout;      ASSERT(ctx);      FD_ZERO(&mask); @@ -207,9 +208,11 @@ unsigned int spio_select(spctx_t* ctx, ...)      for(;;)      { +        /* Select can modify the timeout argument so we copy */ +        memcpy(&timeout, &(g_state.timeout), sizeof(timeout)); +          /* Otherwise wait on more data */ -        switch(select(FD_SETSIZE, &mask, NULL, NULL, -               (struct timeval*)&(g_state.timeout))) +        switch(select(FD_SETSIZE, &mask, NULL, NULL, &timeout))          {          case 0:              sp_messagex(ctx, LOG_ERR, "network operation timed out"); | 
