45b01b7...
by
Daniele Pezzini <email address hidden>
nutscanner: parse debug level opts separately before anything else
In order to have early the value of the desired debug level (needed to correctly debug nutscan_init()), split the parsing of command line options into two loops:
- the first one, before the call to nutscan_init(), will only care about debug level,
- the second one, after the call to nutscan_init(), will consider the remaining (and possibly depending on a nutscan_avail_* var already initialized by nutscan_init()) arguments (and moan in case of errors).
5a040c0...
by
Daniele Pezzini <email address hidden>
Revert "Problem: nutscan_init() called before debug is enabled"
This reverts commit f613d45f78c96c290a1d63d4a2c3f28385d90d42.
When parsing the command line (or showing help), many options rely on a nutscan_avail_* var already initialized by nutscan_init() -- moving that call after the parsing of opts renders those options unavailable.
ace9a27...
by
Daniele Pezzini <email address hidden>
nutscanner: in scan_usb.c, nullify free()'d pointers that are later reused
We assign 'device_name', 'serialnumber' and 'vendor_name' only if the analyzed device provides that data and, since we use these pointers also to check if those items are available so that we can store and free() them, after free()'ing them we must make them NULL, or the next device, if it does not provide that data, will inherit the old (now free()'d) pointer and will attempt to access it and re-free() it.
8725bf9...
by
Charles Lepple <email address hidden>