diff options
author | Nathan Hjelm <hjelmn@google.com> | 2021-06-06 12:19:05 -0600 |
---|---|---|
committer | Nathan Hjelm <hjelmn@google.com> | 2021-06-07 21:28:44 -0600 |
commit | a524555c987fec2c16417d2f58c8713efcbe11a9 (patch) | |
tree | a189629bded2dfd336de94370e195d7fe9ae34b1 /tests | |
parent | d551802db593436947a2464a7da1020edf0e7b56 (diff) | |
download | libusb-a524555c987fec2c16417d2f58c8713efcbe11a9.tar.gz |
core: allow libusb_set_option on the default context before libusb_init
This commit updates libusb_set_option to save the options if setting them on the default
context. This ensures the options 1) can be set before libusb_init(NULL, ...), and 2)
are honored even if the default context is destroyed and re-created.
Signed-off-by: Nathan Hjelm <hjelmn@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/stress.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/stress.c b/tests/stress.c index 6dcb8f3..a5c9d50 100644 --- a/tests/stress.c +++ b/tests/stress.c @@ -130,10 +130,13 @@ static libusb_testlib_result test_default_context_change(void) return TEST_STATUS_FAILURE; } - /* Enable debug output, to be sure to use the context */ - libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG); + /* Enable debug output on new context, to be sure to use the context */ libusb_set_option(ctx, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG); + /* Enable debug outout on the default context. This should work even before + * the context has been created. */ + libusb_set_option(NULL, LIBUSB_OPTION_LOG_LEVEL, LIBUSB_LOG_LEVEL_DEBUG); + /* Now create a reference to the default context */ r = libusb_init(NULL); if (r != LIBUSB_SUCCESS) { |