From: Todd C. Miller Date: Sat, 16 Nov 2013 16:21:43 +0000 (-0700) Subject: log_{fatal,warning} now logs to the debug file itself. X-Git-Tag: SUDO_1_8_9^2~94 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7017c904c1a5defbb65d5c75ad18d6395ecab530;p=sudo log_{fatal,warning} now logs to the debug file itself. log_{fatal,warning} now calls warningx2() after setting the locale itself instead of using the wrapper macros. This removes the only use of warningx(ngettext(...)). --- diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 4cd4398f5..dd4011a5c 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -446,6 +446,15 @@ vlog_warning(int flags, const char *fmt, va_list ap) evasprintf(&message, _(fmt), ap); } + /* Log to debug file. */ + if (USE_ERRNO) { + sudo_debug_printf2(NULL, NULL, 0, + SUDO_DEBUG_WARN|SUDO_DEBUG_ERRNO|sudo_debug_subsys, "%s", message); + } else { + sudo_debug_printf2(NULL, NULL, 0, + SUDO_DEBUG_WARN|sudo_debug_subsys, "%s", message); + } + if (ISSET(flags, MSG_ONLY)) { logline = message; } else { @@ -482,16 +491,18 @@ vlog_warning(int flags, const char *fmt, va_list ap) * Tell the user (in their locale). */ if (!ISSET(flags, NO_STDERR)) { + warning_set_locale(); if (fmt == INCORRECT_PASSWORD_ATTEMPT) { int tries = va_arg(ap2, int); - warningx(ngettext("%d incorrect password attempt", + warningx2(ngettext("%d incorrect password attempt", "%d incorrect password attempts", tries), tries); } else { if (ISSET(flags, USE_ERRNO)) - vwarning(fmt, ap2); + vwarning2(_(fmt), ap2); else - vwarningx(fmt, ap2); + vwarningx2(_(fmt), ap2); } + warning_restore_locale(); va_end(ap2); }