From c99c0285dc5d5fc38fa4dbee1cba70a660578fca Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 2 Nov 2019 13:46:54 +0100 Subject: fdm: fdm_poll(): disallow nested calls --- fdm.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'fdm.c') diff --git a/fdm.c b/fdm.c index e26d394c..c7af68d0 100644 --- a/fdm.c +++ b/fdm.c @@ -142,6 +142,12 @@ fdm_del_no_close(struct fdm *fdm, int fd) bool fdm_poll(struct fdm *fdm) { + assert(!fdm->is_polling && "nested calls to fdm_poll() not allowed"); + if (fdm->is_polling) { + LOG_ERR("nested calls to fdm_poll() not allowed"); + return false; + } + struct epoll_event events[tll_length(fdm->fds)]; int ret = epoll_wait(fdm->epoll_fd, events, tll_length(fdm->fds), -1); if (ret == -1) { -- cgit v1.3