to sudoers_debug_instance when called from the I/O log plugin. This
is because it relied on sudo_debug_register to do that but
sudoers_debug_parse_flags() doesn't set debug_files[]
sudoers_debug_instance is already set (we can only init sudoers
debug once).
To work around this, just make sudoers_debug_instance the active
debug instance in sudoers_debug_register() when it is already set.
/*
* Register the specified debug files and program with the
* debug subsystem, freeing the debug list when done.
+ * Sets the active debug instance as a side effect.
*/
void
sudoers_debug_register(const char *program,
{
struct sudo_debug_file *debug_file, *debug_next;
+ /* Already initialized? */
+ if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) {
+ sudo_debug_set_active_instance(sudoers_debug_instance);
+ }
+
/* Setup debugging if indicated. */
if (debug_files != NULL && !TAILQ_EMPTY(debug_files)) {
if (program != NULL) {