summaryrefslogtreecommitdiffstats
path: root/src/poll.c
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-04-21 19:51:28 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-04-21 19:51:28 +0200
commit175685ed5fbc0db3a259f9cccb30d0a0be74ad30 (patch)
treea1eff3fb33c568dd78a6b7cb4f7eaa282846573b /src/poll.c
parentbda274971e2120e672a4df165cee69d4b7a80d22 (diff)
downloadfastd-175685ed5fbc0db3a259f9cccb30d0a0be74ad30.tar
fastd-175685ed5fbc0db3a259f9cccb30d0a0be74ad30.zip
poll: add pollfd count assert
Diffstat (limited to 'src/poll.c')
-rw-r--r--src/poll.c6
1 files changed, 6 insertions, 0 deletions
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