From 972ea1448eefae3a7e813637cc463dfc2376c4d9 Mon Sep 17 00:00:00 2001 From: Robert Manner Date: Thu, 2 Jan 2020 16:24:54 +0100 Subject: [PATCH] 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. --- plugins/sudoers/sudoers_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/sudoers/sudoers_debug.c b/plugins/sudoers/sudoers_debug.c index 7b208a037..ce6563b09 100644 --- a/plugins/sudoers/sudoers_debug.c +++ b/plugins/sudoers/sudoers_debug.c @@ -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; }