]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
epoll: Handle EPOLLERR as 'readable'
authorDavid Woodhouse <dwmw2@infradead.org>
Wed, 6 Apr 2022 15:42:09 +0000 (16:42 +0100)
committerDavid Woodhouse <dwmw2@infradead.org>
Wed, 6 Apr 2022 15:42:09 +0000 (16:42 +0100)
When we use select(), an error event on a file descriptor causes it to
be reported as readable, and some of the handlers will only clean it up
if that happens. So set the 'readable' flag on EPOLLERR too.

This is part of #389.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
mainloop.c

index a459dfb95a17138dc29deef42d0aa1034a514d8e..4c2863fa682363697c47e73355c5689d6c1fe437 100644 (file)
@@ -372,7 +372,7 @@ int openconnect_mainloop(struct openconnect_info *vpninfo,
                                nfds = 0;
                        }
                        while (nfds--) {
-                               if (evs[nfds].events & EPOLLIN) {
+                               if (evs[nfds].events & (EPOLLIN|EPOLLERR)) {
                                        if (evs[nfds].data.fd == vpninfo->tun_fd)
                                                tun_r = 1;
                                        else if (evs[nfds].data.fd == vpninfo->ssl_fd)