usb_bulk_read: may return 0 on timeout.

Pointed out by Jasper Lievisse Adriaanse <jasper@openbsd.org>.
This commit is contained in:
Daniel Beer 2011-09-07 08:18:00 +12:00
parent a0ece48e4e
commit 7a0a30f626
2 changed files with 2 additions and 2 deletions

View File

@ -272,7 +272,7 @@ transport_t olimex_open(const char *devpath, const char *requested_serial)
/* Flush out lingering data */
while (usb_bulk_read(tr->handle, tr->in_ep,
buf, sizeof(buf),
100) >= 0);
100) > 0);
return (transport_t)tr;
}

View File

@ -231,7 +231,7 @@ transport_t rf2500_open(const char *devpath, const char *requested_serial)
#ifndef __APPLE__
while (usb_bulk_read(tr->handle, USB_FET_IN_EP,
buf, sizeof(buf),
100) >= 0);
100) > 0);
#endif
return (transport_t)tr;