From: Todd C. Miller Date: Fri, 27 Dec 2013 13:50:06 +0000 (-0700) Subject: Use sudoers_initlocale() in main() startup, not sudoers_setlocal() X-Git-Tag: SUDO_1_8_9^2~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=91db1efe919f24c2cfe36f946ab8b3ec105bfa8d;p=sudo Use sudoers_initlocale() in main() startup, not sudoers_setlocal() as the latter assumes we are already in the user's locale which may not be the case. For sudoreplay, we can just use setlocale() directly as there is no sudoers locale. --- diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index 3b28633c0..e7e047c46 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -242,7 +242,7 @@ main(int argc, char *argv[]) #endif initprogname(argc > 0 ? argv[0] : "sudoreplay"); - sudoers_setlocale(SUDOERS_LOCALE_USER, NULL); + setlocale(LC_ALL, NULL); decimal = localeconv()->decimal_point; bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have sudoreplay domain */ textdomain("sudoers"); diff --git a/plugins/sudoers/testsudoers.c b/plugins/sudoers/testsudoers.c index 66ded058e..7105b093a 100644 --- a/plugins/sudoers/testsudoers.c +++ b/plugins/sudoers/testsudoers.c @@ -134,7 +134,7 @@ main(int argc, char *argv[]) initprogname(argc > 0 ? argv[0] : "testsudoers"); - sudoers_setlocale(SUDOERS_LOCALE_USER, NULL); + sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale); bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */ textdomain("sudoers"); diff --git a/plugins/sudoers/visudo.c b/plugins/sudoers/visudo.c index 0dcd60337..f24da1de1 100644 --- a/plugins/sudoers/visudo.c +++ b/plugins/sudoers/visudo.c @@ -159,7 +159,7 @@ main(int argc, char *argv[]) #endif initprogname(argc > 0 ? argv[0] : "visudo"); - sudoers_setlocale(SUDOERS_LOCALE_USER, NULL); + sudoers_initlocale(setlocale(LC_ALL, NULL), def_sudoers_locale); bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */ textdomain("sudoers");