plugins/sudoers/sudoers_debug.c: fix harmless debug deregistration warning
If the debug sudoers subsystem is not registered, because it does not get any file names to deal with (TAILQ_EMPTY(debug_files)), deregistration of the subsystem outputs a warning: sudo: sudo_debug_deregister_v1: invalid instance ID -1, max -1 This patch prevents that by only increasing the refcount if the debug_instance was registered successfully.
This commit is contained in:

committed by
Todd C. Miller

parent
3e9d15a4da
commit
972ea1448e
@@ -138,6 +138,8 @@ sudoers_debug_register(const char *program,
|
||||
sudoers_subsystem_names, sudoers_subsystem_ids, debug_files);
|
||||
if (sudoers_debug_instance == SUDO_DEBUG_INSTANCE_ERROR)
|
||||
return false;
|
||||
|
||||
sudoers_debug_refcnt++;
|
||||
}
|
||||
TAILQ_FOREACH_SAFE(debug_file, debug_files, entries, debug_next) {
|
||||
TAILQ_REMOVE(debug_files, debug_file, entries);
|
||||
@@ -146,7 +148,6 @@ sudoers_debug_register(const char *program,
|
||||
free(debug_file);
|
||||
}
|
||||
}
|
||||
sudoers_debug_refcnt++;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user