Page MenuHomeFreeBSD

libusb: let LIBUSB_DEBUG environment variable override libusb_set_debug
ClosedPublic

Authored by kevans on Oct 2 2019, 1:43 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 30, 7:58 PM
Unknown Object (File)
Nov 13 2024, 3:58 PM
Unknown Object (File)
Oct 6 2024, 9:46 PM
Unknown Object (File)
Sep 27 2024, 4:58 AM
Unknown Object (File)
Sep 25 2024, 2:17 AM
Unknown Object (File)
Sep 24 2024, 5:23 PM
Unknown Object (File)
Sep 23 2024, 3:11 PM
Unknown Object (File)
Sep 23 2024, 2:06 AM
Subscribers

Details

Summary

The debug level generally just controls verbosity of libusb for debugging libusb devices/usage. We allow the environment to set the debug level independent of the application, but the application will always override this if it explicitly sets the debug level.

Changing the environment is easy, but patching the software to change the debug level isn't necessarily easy or possible. Further, there's this write-only debug_fixed variable that would seem to imply that the debug level should be fixed, but it isn't currently used. Change the logic to use strtol() so we can detect real 0 vs. conversion failure, then honor debug_fixed in libusb_set_debug.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lib/libusb/libusb10.c
151 ↗(On Diff #62829)

I think it is enough to check if *ep == '\0' ?

lib/libusb/libusb10.c
151 ↗(On Diff #62829)

You have to check errno, too, because if you have all valid digits but simply hit overflow then *ep == '\0' but errno == ERANGE.

This revision is now accepted and ready to land.Oct 2 2019, 2:34 PM