Decrement poll() result when internal pipe has been handled
authorDaniel Drake <dsd@gentoo.org>
Sat, 17 Jan 2009 00:25:40 +0000 (00:25 +0000)
committerDaniel Drake <dsd@gentoo.org>
Sat, 17 Jan 2009 00:29:36 +0000 (00:29 +0000)
When we receive data on the internal control pipe, we need to correctly
decrement the number of ready file descriptors before passing on the
remaining work to the OS implementation.

libusb/io.c

index 320bc4b..b053f85 100644 (file)
@@ -1587,6 +1587,7 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv)
                } else {
                        /* prevent OS backend from trying to handle events on ctrl pipe */
                        fds[0].revents = 0;
+                       r--;
                }
        }