aboutsummaryrefslogtreecommitdiffstats
path: root/src/cg-base.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-08-05 13:29:06 +0200
committerMattias Andrée <maandree@kth.se>2016-08-05 13:29:06 +0200
commitcb28632c128848993c7a829af15eaadfc0db7115 (patch)
treec31b10c3de324da485699c3d4111d1c89d44521f /src/cg-base.c
parentderp (diff)
downloadcg-tools-cb28632c128848993c7a829af15eaadfc0db7115.tar.gz
cg-tools-cb28632c128848993c7a829af15eaadfc0db7115.tar.bz2
cg-tools-cb28632c128848993c7a829af15eaadfc0db7115.tar.xz
Reset revents before polling
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--src/cg-base.c9
1 files 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;