summaryrefslogtreecommitdiff
path: root/usbredirhost
diff options
context:
space:
mode:
authorVictor Toso <victortoso@redhat.com>2021-02-10 17:50:34 +0100
committerFrediano Ziglio <freddy77@gmail.com>2021-02-16 07:26:16 +0000
commit2bc242d5a88dfba1e66772fb6226e9576cf57df9 (patch)
tree21c4dae7df0d15f29bc03c5335f8e458bdb6fa7a /usbredirhost
parent6dd196cd52c2309e792bbd1b155fc72f05d97bae (diff)
usbredirhost: handle return value from libusb_set_option()
Otherwise, we don't get the logs in case of bad input or any other underlying issue. Signed-off-by: Victor Toso <victortoso@redhat.com> Acked-by: Frediano Ziglio <freddy77@gmail.com>
Diffstat (limited to 'usbredirhost')
-rw-r--r--usbredirhost/usbredirhost.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c
index d84ad2c..e876ebd 100644
--- a/usbredirhost/usbredirhost.c
+++ b/usbredirhost/usbredirhost.c
@@ -752,7 +752,12 @@ struct usbredirhost *usbredirhost_open_full(
parser_flags);
#if LIBUSB_API_VERSION >= 0x01000106
- libusb_set_option(host->ctx, LIBUSB_OPTION_LOG_LEVEL, host->verbose);
+ int ret = libusb_set_option(host->ctx, LIBUSB_OPTION_LOG_LEVEL, host->verbose);
+ if (ret != LIBUSB_SUCCESS) {
+ ERROR("error setting libusb log level: %s", libusb_error_name(ret));
+ usbredirhost_close(host);
+ return NULL;
+ }
#else
libusb_set_debug(host->ctx, host->verbose);
#endif