I recently wrote a couple of wrappers for connecting other mainloop
interfaces to UCW mainloop. Unfortunately, asking a mainloop to stop
watching a file a moment after close() is a common (mal)practice.
Working around it in the wrapper is hard to do, so I relax the checks
in LibUCW instead.
m->file_cnt--;
#ifdef CONFIG_UCW_EPOLL
if (m->epoll_fd >= 0 && epoll_ctl(m->epoll_fd, EPOLL_CTL_DEL, fi->fd, NULL) < 0)
- die("epoll_ctl() failed: %m");
+ {
+ // Some clients call file_del() on an already closed descriptor. Trying to be benevolent.
+ if (errno != EBADF)
+ die("epoll_ctl() failed: %m");
+ }
#else
m->poll_table_obsolete = 1;
#endif