fdm: fdm_poll(): disallow nested calls

This commit is contained in:
Daniel Eklöf 2019-11-02 13:46:54 +01:00
parent 338747dc5a
commit c99c0285dc
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

6
fdm.c
View file

@ -142,6 +142,12 @@ fdm_del_no_close(struct fdm *fdm, int fd)
bool bool
fdm_poll(struct fdm *fdm) 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)]; struct epoll_event events[tll_length(fdm->fds)];
int ret = epoll_wait(fdm->epoll_fd, events, tll_length(fdm->fds), -1); int ret = epoll_wait(fdm->epoll_fd, events, tll_length(fdm->fds), -1);
if (ret == -1) { if (ret == -1) {