Only display an error in the built-in policy close if command is set.

If a policy or approval plugin denies the command, command_details
will not have been filled out.
This commit is contained in:
Todd C. Miller
2020-06-04 13:31:03 -06:00
parent 49e43f580c
commit 1198dfc930

View File

@@ -1117,9 +1117,11 @@ policy_close(int exit_status, int error_code)
sudo_debug_set_active_instance(policy_plugin.debug_instance);
policy_plugin.u.policy->close(exit_status, error_code);
sudo_debug_set_active_instance(sudo_debug_instance);
} else if (error_code) {
errno = error_code;
sudo_warn(U_("unable to execute %s"), command_details.command);
} else if (error_code != 0) {
if (command_details.command != NULL) {
errno = error_code;
sudo_warn(U_("unable to execute %s"), command_details.command);
}
}
debug_return;