From 0b315c10d0a451be058389bb8690619d027a0c14 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 10 Feb 2005 03:24:00 +0000 Subject: [PATCH] Set locale to "C" if locales are supported, just to be safe. --- config.h.in | 3 +++ configure | 4 +++- configure.in | 3 ++- sudo.c | 7 +++++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config.h.in b/config.h.in index 05147ee43..670d5f3d2 100644 --- a/config.h.in +++ b/config.h.in @@ -254,6 +254,9 @@ /* Define to 1 if you use SecurID for authentication. */ #undef HAVE_SECURID +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE + /* Define to 1 if you have the `setproctitle' function. */ #undef HAVE_SETPROCTITLE diff --git a/configure b/configure index 88ac9075d..668b6e3c3 100755 --- a/configure +++ b/configure @@ -25887,8 +25887,10 @@ esac + for ac_func in strchr strrchr memchr memcpy memmove memset sysconf tzset \ - strftime setrlimit initgroups getgroups fstat gettimeofday + strftime setrlimit initgroups getgroups fstat gettimeofday \ + setlocale do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 378f534c2..c5042f5dd 100644 --- a/configure.in +++ b/configure.in @@ -1714,7 +1714,8 @@ dnl dnl Function checks dnl AC_CHECK_FUNCS(strchr strrchr memchr memcpy memmove memset sysconf tzset \ - strftime setrlimit initgroups getgroups fstat gettimeofday) + strftime setrlimit initgroups getgroups fstat gettimeofday \ + setlocale) if test -z "$SKIP_SETRESUID"; then AC_CHECK_FUNCS(setresuid, [SKIP_SETREUID=yes]) fi diff --git a/sudo.c b/sudo.c index ea50d9baf..eba4c1673 100644 --- a/sudo.c +++ b/sudo.c @@ -67,6 +67,9 @@ #if TIME_WITH_SYS_TIME # include #endif +#ifdef HAVE_SETLOCALE +# include +#endif #include #include #if defined(HAVE_GETPRPWNAM) && defined(HAVE_SET_AUTH_PARAMETERS) @@ -156,6 +159,10 @@ main(argc, argv, envp) #endif extern char **environ; +#ifdef HAVE_SETLOCALE + setlocale(LC_ALL, "C"); +#endif + Argv = argv; if ((Argc = argc) < 1) usage(1); -- 2.40.0