Add sudoers_debug_deregister() and use it instead of calling

sudo_debug_deregister() directly.
This commit is contained in:
Todd C. Miller
2014-10-27 16:06:20 -06:00
parent 0982f7838b
commit 9d6e1a57d5
6 changed files with 24 additions and 17 deletions

View File

@@ -110,8 +110,8 @@ sudoers_debug_parse_flags(struct sudo_conf_debug_file_list *debug_files,
* debug subsystem, freeing the debug list when done.
*/
void
sudoers_debug_register(struct sudo_conf_debug_file_list *debug_files,
const char *program)
sudoers_debug_register(const char *program,
struct sudo_conf_debug_file_list *debug_files)
{
struct sudo_debug_file *debug_file, *debug_next;
@@ -129,3 +129,17 @@ sudoers_debug_register(struct sudo_conf_debug_file_list *debug_files,
}
}
}
/*
* Deregister sudoers_debug_instance if it is registered.
*/
void
sudoers_debug_deregister(void)
{
debug_decl(sudoers_debug_deregister, SUDOERS_DEBUG_PLUGIN, sudoers_debug_instance)
if (sudoers_debug_instance != SUDO_DEBUG_INSTANCE_INITIALIZER) {
sudo_debug_exit(__func__, __FILE__, __LINE__, sudo_debug_subsys);
sudo_debug_deregister(sudoers_debug_instance);
sudoers_debug_instance = SUDO_DEBUG_INSTANCE_INITIALIZER;
}
}