For messages received on the hotplug pipe, the message was read via usbi_read() (ssize_t) and compared against the size of the message struct (size_t). usbi_read() returns -1 on an error condition, so some systems can cast the ssize_t to size_t for the comparison, making it equal to SIZE_MAX and causing the error check condition to incorrectly evaluate to false. --- libusb/io.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libusb/io.c b/libusb/io.c index 4368b99..ead933d 100644 --- a/libusb/io.c +++ b/libusb/io.c @@ -1995,9 +1995,9 @@ static int handle_events(struct libusb_context *ctx, struct timeval *tv) usbi_dbg("caught a fish on the hotplug pipe"); /* read the message from the hotplug thread */ - ret = usbi_read(ctx->hotplug_pipe[0], &message, sizeof (message)); - if (ret < sizeof(message)) { - usbi_err(ctx, "hotplug pipe read error %d < %d", + ret = usbi_read(ctx->hotplug_pipe[0], &message, sizeof(message)); + if (ret != sizeof(message)) { + usbi_err(ctx, "hotplug pipe read error %d != %u", ret, sizeof(message)); r = LIBUSB_ERROR_OTHER; goto handled; -- 1.7.6 ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel