summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Rousseau <ludovic.rousseau+github@gmail.com>2013-09-22 21:15:56 +0200
committerLudovic Rousseau <ludovic.rousseau+github@gmail.com>2013-09-28 12:14:13 +0200
commitaa00030b78b4e46511c32c76c08ea031eacef8d1 (patch)
tree013520cfef40999bc903c097ed782712079933a3
parentd09389be6f91f5e6a382a90f68916e8ee7444a60 (diff)
downloadlibusb-aa00030b78b4e46511c32c76c08ea031eacef8d1.tar.gz
examples: check the value returned by libusb_init()
Problem detected by the Coverity tool CID 1042538 (#1 of 1): Unchecked return value (CHECKED_RETURN)4. check_return: Calling function "libusb_init(libusb_context **)" without checking return value (as is done elsewhere 11 out of 12 times).
-rw-r--r--examples/hotplugtest.c7
-rw-r--r--libusb/version_nano.h2
2 files changed, 7 insertions, 2 deletions
diff --git a/examples/hotplugtest.c b/examples/hotplugtest.c
index fef01af..6cdf0c8 100644
--- a/examples/hotplugtest.c
+++ b/examples/hotplugtest.c
@@ -65,7 +65,12 @@ int main(int argc, char *argv[])
product_id = (argc > 2) ? strtol (argv[2], NULL, 0) : 0x5005;
class_id = (argc > 3) ? strtol (argv[3], NULL, 0) : LIBUSB_HOTPLUG_MATCH_ANY;
- libusb_init (NULL);
+ rc = libusb_init (NULL);
+ if (rc < 0)
+ {
+ printf("failed to initialise libusb: %s\n", libusb_error_name(rc));
+ return EXIT_FAILURE;
+ }
if (!libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)) {
printf ("Hotplug capabilites are not supported on this platform\n");
diff --git a/libusb/version_nano.h b/libusb/version_nano.h
index a833d52..a387990 100644
--- a/libusb/version_nano.h
+++ b/libusb/version_nano.h
@@ -1 +1 @@
-#define LIBUSB_NANO 10839
+#define LIBUSB_NANO 10840