From 175685ed5fbc0db3a259f9cccb30d0a0be74ad30 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Mon, 21 Apr 2014 19:51:28 +0200 Subject: poll: add pollfd count assert --- src/poll.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/poll.c') diff --git a/src/poll.c b/src/poll.c index 79b847a..2a2ef34 100644 --- a/src/poll.c +++ b/src/poll.c @@ -269,6 +269,9 @@ void fastd_poll_handle(void) { if (timeout < 0 || timeout > maintenance_timeout) timeout = maintenance_timeout; + if (VECTOR_LEN(ctx.pollfds) != 2 + ctx.n_socks + VECTOR_LEN(ctx.peers)) + exit_bug("fd count mismatch"); + int ret = poll(VECTOR_DATA(ctx.pollfds), VECTOR_LEN(ctx.pollfds), timeout); if (ret < 0) { if (errno == EINTR) @@ -305,6 +308,9 @@ void fastd_poll_handle(void) { fastd_receive(peer->sock); } } + + if (VECTOR_LEN(ctx.pollfds) != 2 + ctx.n_socks + VECTOR_LEN(ctx.peers)) + exit_bug("fd count mismatch"); } #endif -- cgit v1.2.3