core: Ensure that reported event bits are initialized
Closes #774
Signed-off-by: Chris Dickens <christopher.a.dickens@gmail.com>
diff --git a/libusb/io.c b/libusb/io.c
index 48e964d..272177e 100644
--- a/libusb/io.c
+++ b/libusb/io.c
@@ -2229,6 +2229,8 @@
if (tv->tv_usec % 1000)
timeout_ms++;
+ reported_events.event_bits = 0;
+
usbi_start_event_handling(ctx);
r = usbi_wait_for_events(ctx, &reported_events, timeout_ms);
diff --git a/libusb/libusbi.h b/libusb/libusbi.h
index b5b4a2a..d0e57e4 100644
--- a/libusb/libusbi.h
+++ b/libusb/libusbi.h
@@ -686,10 +686,15 @@
}
struct usbi_reported_events {
- unsigned int event_triggered:1;
+ union {
+ struct {
+ unsigned int event_triggered:1;
#ifdef HAVE_OS_TIMER
- unsigned int timer_triggered:1;
+ unsigned int timer_triggered:1;
#endif
+ };
+ unsigned int event_bits;
+ };
void *event_data;
unsigned int event_data_count;
unsigned int num_ready;
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index acdfcec..a0044a0 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 11549
+#define LIBUSB_NANO 11550