Hello, libusb_init() could return non zero value/negative when it failed to initialize. I feel that it could be good to have early notification when there is something wrong with libusb.
Best regards, DWI
From 3154a2053af99ce6931583f703f4ee585a10e257 Mon Sep 17 00:00:00 2001 From: Dwi Sasongko S <[email protected]> Date: Fri, 8 Jul 2011 13:12:04 +0700 Subject: [PATCH] Check return value of libusb_init() Signed-off-by: Dwi Sasongko S <[email protected]> --- src/hotplug_libusb.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hotplug_libusb.c b/src/hotplug_libusb.c index ddd5391..6d0ff6e 100644 --- a/src/hotplug_libusb.c +++ b/src/hotplug_libusb.c @@ -388,10 +388,14 @@ static void HPRescanUsbBus(void) static void HPEstablishUSBNotifications(int pipefd[2]) { - int i, do_polling; + int i, do_polling, rv; char c = 42; /* magic value */ - libusb_init(ctx); + rv = libusb_init(ctx); + if (rv < 0) { + Log1(PCSC_LOG_ERROR, "Failed to initialise libusb"); + exit(1); + } /* scan the USB bus for devices at startup */ HPRescanUsbBus(); -- 1.7.0.4
_______________________________________________ Muscle mailing list [email protected] http://lists.drizzle.com/mailman/listinfo/muscle
