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.
/* 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",
+ if (ret != sizeof(message)) {
+ usbi_err(ctx, "hotplug pipe read error %d != %u",
ret, sizeof(message));
r = LIBUSB_ERROR_OTHER;
goto handled;
-#define LIBUSB_NANO 10798
+#define LIBUSB_NANO 10799