[client] x11: handle EINTR properly in epoll loop

This commit is contained in:
Geoffrey McRae 2021-10-20 15:40:50 +11:00
parent dca5da02a0
commit 9c5e34df0f

View File

@ -27,6 +27,7 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/epoll.h> #include <sys/epoll.h>
#include <errno.h>
#include <X11/extensions/XInput2.h> #include <X11/extensions/XInput2.h>
#include <X11/extensions/scrnsaver.h> #include <X11/extensions/scrnsaver.h>
@ -748,6 +749,9 @@ static int x11EventThread(void * unused)
int nfds = epoll_wait(epollfd, events, 1, 100); int nfds = epoll_wait(epollfd, events, 1, 100);
if (nfds == -1) if (nfds == -1)
{ {
if (errno == EINTR)
continue;
close(epollfd); close(epollfd);
DEBUG_ERROR("epoll_wait failure"); DEBUG_ERROR("epoll_wait failure");
return 0; return 0;