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)
Feb 11 2024, 10:02 PM
Unknown Object (File)
Jan 8 2024, 8:45 PM
Unknown Object (File)
Jan 4 2024, 6:28 AM
Unknown Object (File)
Jan 4 2024, 6:28 AM
Unknown Object (File)
Jan 4 2024, 6:28 AM
Unknown Object (File)
Jan 4 2024, 6:16 AM
Unknown Object (File)
Dec 21 2023, 9:17 PM
Unknown Object (File)
Nov 3 2023, 11:26 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 26831

Event Timeline

lib/libusb/libusb10.c
151

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

lib/libusb/libusb10.c
151

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