From cb28632c128848993c7a829af15eaadfc0db7115 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 5 Aug 2016 13:29:06 +0200 Subject: Reset revents before polling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/cg-base.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cg-base.c b/src/cg-base.c index 9056e42..5aa9246 100644 --- a/src/cg-base.c +++ b/src/cg-base.c @@ -265,6 +265,7 @@ int synchronise(int timeout) if (flush_pending > 0) pollfd.events |= POLLOUT; + pollfd.revents = 0; if (poll(&pollfd, (nfds_t)1, timeout) < 0) return -1; @@ -277,8 +278,11 @@ int synchronise(int timeout) if ((timeout < 0) && (pending_recvs > 0)) if (!(pollfd.revents & (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI))) - if (poll(&pollfd, (nfds_t)1, -1) < 0) - return -1; + { + pollfd.revents = 0; + if (poll(&pollfd, (nfds_t)1, -1) < 0) + return -1; + } sync: if (pollfd.revents & (POLLIN | POLLRDNORM | POLLRDBAND | POLLPRI | POLLERR | POLLHUP | POLLNVAL)) @@ -430,6 +434,7 @@ static int get_crtc_info(void) else pollfd.events &= ~POLLOUT; + pollfd.revents = 0; if (poll(&pollfd, (nfds_t)1, -1) < 0) goto fail; -- cgit v1.2.3-70-g09d2