core: Apply default options to all new contexts

The default options configured with libusb_set_option(NULL, ...)
were only applied when the default context was created, and were
ignored when calling libusb_init() with a non-null context pointer.

Make sure the default options will be applied to all new contexts. This
is important when using LIBUSB_OPTION_NO_DEVICE_DISCOVERY which must
be respected during the context initialization in order to work.

Closes #942

[Tormod: amend comments]
Signed-off-by: Tormod Volden <>
2 files changed