summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDaniel Drake <dsd@gentoo.org>2008-05-04 00:51:59 +0100
committerDaniel Drake <dsd@gentoo.org>2008-05-04 00:51:59 +0100
commit5878daa85e3364bb3885190425d4f9deaa2d8c36 (patch)
tree12b7ece4e65b58b7d36b6e9dc07af14ab285e61c /examples
parenta74106a9b48b88bae0e099be34a18d653a8f1238 (diff)
downloadlibusb-5878daa85e3364bb3885190425d4f9deaa2d8c36.tar.gz
Fix libusb_get_device_list return value
It was documented to return the list length, but was returning 0.
Diffstat (limited to 'examples')
-rw-r--r--examples/lsusb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/lsusb.c b/examples/lsusb.c
index 9aad2bf..193b23a 100644
--- a/examples/lsusb.c
+++ b/examples/lsusb.c
@@ -39,14 +39,15 @@ int main(void)
{
libusb_device **devs;
int r;
+ size_t cnt;
r = libusb_init();
if (r < 0)
return r;
- r = libusb_get_device_list(&devs);
- if (r < 0)
- return r;
+ cnt = libusb_get_device_list(&devs);
+ if (cnt < 0)
+ return (int) cnt;
print_devs(devs);
libusb_free_device_list(devs, 1);