diff options
author | Francis Hart <francis@kuvacode.com> | 2022-10-17 11:41:52 +0300 |
---|---|---|
committer | Nathan Hjelm <hjelmn@google.com> | 2023-01-09 20:47:02 -0700 |
commit | 565bb18011d72d4aec2b24c11bba27c783863930 (patch) | |
tree | a51a4d3dff33de2429c42027f099177d902b03fd | |
parent | b09074ea77cf39da31554cfc816d76b837fb26b7 (diff) | |
download | libusb-565bb18011d72d4aec2b24c11bba27c783863930.tar.gz |
Fix setting log level before libusb_init()
The header docs state its possible to set a default log level before
calling libusb_init(), and that this log level will be used for all
contexts created after (to quote):
"Note that libusb_set_option(NULL, ...) is special, and adds
an option to a list of default options for new contexts."
This updates the logic inside libusb_init() to ensure this
behaviour is followed.
Fixes #1207
Signed-off-by: Francis Hart <francis@kuvacode.com>
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
-rw-r--r-- | libusb/core.c | 2 | ||||
-rw-r--r-- | libusb/version_nano.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/libusb/core.c b/libusb/core.c index 4f98ef9..634002b 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -2306,7 +2306,7 @@ int API_EXPORTED libusb_init(libusb_context **ctx) } #if defined(ENABLE_LOGGING) && !defined(ENABLE_DEBUG_LOGGING) - if (NULL == ctx && default_context_options[LIBUSB_OPTION_LOG_LEVEL].is_set) { + if (default_context_options[LIBUSB_OPTION_LOG_LEVEL].is_set) { _ctx->debug = default_context_options[LIBUSB_OPTION_LOG_LEVEL].arg.ival; } else { _ctx->debug = get_env_debug_level(); diff --git a/libusb/version_nano.h b/libusb/version_nano.h index dea5b36..aa4bdc0 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11758 +#define LIBUSB_NANO 11759 |