Instead of trying to make weak functions work on all platforms,

just use a registration function for a plugin-specific setlocale
function.  The sudoers version just wraps sudoers_setlocale().
This commit is contained in:
Todd C. Miller
2015-05-11 14:51:32 -06:00
parent fc7143760b
commit 8bc70a635c
19 changed files with 90 additions and 940 deletions

View File

@@ -110,30 +110,10 @@ sudoers_setlocale(int newlocale, int *prevlocale)
return res ? true : false;
}
#ifdef HAVE_LIBINTL_H
char *
sudo_warn_gettext_v1(const char *msgid)
bool
sudoers_warn_setlocale(bool restore, int *cookie)
{
int warning_locale;
char *msg;
sudoers_setlocale(SUDOERS_LOCALE_USER, &warning_locale);
msg = gettext(msgid);
sudoers_setlocale(warning_locale, NULL);
return msg;
}
#endif /* HAVE_LIBINTL_H */
char *
sudo_warn_strerror_v1(int errnum)
{
int warning_locale;
char *errmsg;
sudoers_setlocale(SUDOERS_LOCALE_USER, &warning_locale);
errmsg = strerror(errnum);
sudoers_setlocale(warning_locale, NULL);
return errmsg;
if (restore)
return sudoers_setlocale(*cookie, NULL);
return sudoers_setlocale(SUDOERS_LOCALE_USER, cookie);
}