diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-21 19:51:28 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-04-21 19:51:28 +0200 |
commit | 175685ed5fbc0db3a259f9cccb30d0a0be74ad30 (patch) | |
tree | a1eff3fb33c568dd78a6b7cb4f7eaa282846573b | |
parent | bda274971e2120e672a4df165cee69d4b7a80d22 (diff) | |
download | fastd-175685ed5fbc0db3a259f9cccb30d0a0be74ad30.tar fastd-175685ed5fbc0db3a259f9cccb30d0a0be74ad30.zip |
poll: add pollfd count assert
-rw-r--r-- | src/poll.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |