Avoid unused variable warning if auditing is not supported.

This commit is contained in:
Todd C. Miller
2014-05-02 05:25:57 -06:00
parent a297a19fb4
commit 983ab1d163

View File

@@ -70,15 +70,17 @@ audit_success(char *exec_args[])
int int
audit_failure(char *exec_args[], char const *const fmt, ...) audit_failure(char *exec_args[], char const *const fmt, ...)
{ {
va_list ap;
int oldlocale;
int rc = 0; int rc = 0;
debug_decl(audit_success, SUDO_DEBUG_AUDIT) debug_decl(audit_success, SUDO_DEBUG_AUDIT)
/* Audit error messages should be in the sudoers locale. */ #if defined(HAVE_BSM_AUDIT) || defined(HAVE_LINUX_AUDIT)
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
if (exec_args != NULL) { if (exec_args != NULL) {
va_list ap;
int oldlocale;
/* Audit error messages should be in the sudoers locale. */
sudoers_setlocale(SUDOERS_LOCALE_SUDOERS, &oldlocale);
#ifdef HAVE_BSM_AUDIT #ifdef HAVE_BSM_AUDIT
va_start(ap, fmt); va_start(ap, fmt);
if (bsm_audit_failure(exec_args, _(fmt), ap) == -1) if (bsm_audit_failure(exec_args, _(fmt), ap) == -1)
@@ -91,9 +93,10 @@ audit_failure(char *exec_args[], char const *const fmt, ...)
rc = -1; rc = -1;
va_end(ap); va_end(ap);
#endif #endif
}
sudoers_setlocale(oldlocale, NULL); sudoers_setlocale(oldlocale, NULL);
}
#endif /* HAVE_BSM_AUDIT || HAVE_LINUX_AUDIT */
debug_return_int(rc); debug_return_int(rc);
} }