From e36d27a2a68afae0792f1808e13b2863f5c7dff9 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 15 Nov 2005 16:39:22 +0000 Subject: Fix crasher after closing connection. --- common/spio.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'common/spio.c') 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; } -- cgit v1.2.3