diff options
author | Stef Walter <stef@memberwebs.com> | 2005-11-15 16:39:22 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2005-11-15 16:39:22 +0000 |
commit | e36d27a2a68afae0792f1808e13b2863f5c7dff9 (patch) | |
tree | 20f4bb0d04ba85b96c58cb66d3016101293dd19a | |
parent | 42eaa43cc8856f90673193e87d51285facf1e24b (diff) |
Fix crasher after closing connection.
-rw-r--r-- | common/spio.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/common/spio.c b/common/spio.c index f2198c0..46143bb 100644 --- a/common/spio.c +++ b/common/spio.c @@ -282,20 +282,25 @@ unsigned int spio_select(spctx_t* ctx, ...) while((io = va_arg(ap, spio_t*)) != NULL) { - /* We can't handle more than 31 args */ - if(i > (sizeof(int) * 8) - 2) - break; + if(spio_valid(io)) + { + /* We can't handle more than 31 args */ + if(i > (sizeof(int) * 8) - 2) + break; - /* We have data on the descriptor, which is an action */ - io->last_action = time(NULL); + /* We have data on the descriptor, which is an action */ + io->last_action = time(NULL); - /* Check if the buffer has something in it */ - if(FD_ISSET(io->fd, &mask)) - ret |= (1 << i); + /* Check if the buffer has something in it */ + if(FD_ISSET(io->fd, &mask)) + ret |= (1 << i); + } i++; } + va_end(ap); + return ret; } |