summaryrefslogtreecommitdiff
path: root/common/spio.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/spio.c')
-rw-r--r--common/spio.c21
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;
}