]> granicus.if.org Git - sudo/commitdiff
#unifdef HAVE_SETLOCALE, it is C89 so no need to check for it.
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 12 Nov 2012 13:51:58 +0000 (08:51 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 12 Nov 2012 13:51:58 +0000 (08:51 -0500)
14 files changed:
common/sudo_conf.c
config.h.in
configure
configure.in
include/gettext.h
plugins/sudoers/locale.c
plugins/sudoers/sudoers.c
plugins/sudoers/sudoreplay.c
plugins/sudoers/testsudoers.c
plugins/sudoers/visudo.c
src/error.c
src/exec.c
src/sesh.c
src/sudo.c

index 608a78b3c56198f2e3f4521871db4a40fbd80a4d..f8ec9d3078a1464841e98354f8df491cf7b6f81c 100644 (file)
@@ -294,14 +294,11 @@ sudo_conf_read(void)
     struct sudo_conf_table *cur;
     struct stat sb;
     FILE *fp;
-    char *cp;
-#ifdef HAVE_SETLOCALE
-    char *prev_locale = estrdup(setlocale(LC_ALL, NULL));
+    char *cp, *prev_locale = estrdup(setlocale(LC_ALL, NULL));
 
     /* Parse sudo.conf in the "C" locale. */
     if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
         setlocale(LC_ALL, "C");
-#endif
 
     switch (sudo_secure_file(_PATH_SUDO_CONF, ROOT_UID, -1, &sb)) {
        case SUDO_PATH_SECURE:
@@ -353,11 +350,9 @@ sudo_conf_read(void)
     }
     fclose(fp);
 done:
-#ifdef HAVE_SETLOCALE
     /* Restore locale if needed. */
     if (prev_locale[0] != 'C' || prev_locale[1] != '\0')
         setlocale(LC_ALL, prev_locale);
     efree(prev_locale);
-#endif
     return;
 }
index 8aedaade06bade8687f078f5e3096844fca79f2f..bead6ae8cbc91668ea0961704165993a34820c68 100644 (file)
 /* Define to 1 if you have the `setkeycreatecon' function. */
 #undef HAVE_SETKEYCREATECON
 
-/* Define to 1 if you have the `setlocale' function. */
-#undef HAVE_SETLOCALE
-
 /* Define to 1 if you have the `setresuid' function. */
 #undef HAVE_SETRESUID
 
index 4af44088cec19c50acb508f6bdb7da123315d7b5..d3b8c62e8baacabcb1bb5b682c4f2de3e0c495dd 100755 (executable)
--- a/configure
+++ b/configure
@@ -16630,7 +16630,7 @@ fi
 LIBS=$ac_save_LIBS
 
 for ac_func in glob strrchr sysconf tzset strftime setenv \
-              regcomp setlocale nl_langinfo mbr_check_membership \
+              regcomp nl_langinfo mbr_check_membership \
               setrlimit64
 do :
   as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
index 7e40144d18c446b217eed1896e099eb7b69dd43b..3d0f0af6fab0087934d4e1ac3857008ee1af0838 100644 (file)
@@ -2216,7 +2216,7 @@ dnl Function checks
 dnl
 AC_FUNC_GETGROUPS
 AC_CHECK_FUNCS(glob strrchr sysconf tzset strftime setenv \
-              regcomp setlocale nl_langinfo mbr_check_membership \
+              regcomp nl_langinfo mbr_check_membership \
               setrlimit64)
 AC_REPLACE_FUNCS(getgrouplist)
 AC_CHECK_FUNCS(getline, [], [
index db1f3591088d5e1828b82f5063dd3afc483d5196..95e48aaf082a18f4815d2104f89b3d66818b51c8 100644 (file)
@@ -21,9 +21,7 @@
  * Solaris locale.h includes libintl.h which causes problems when we
  * redefine the gettext functions.  We include it first to avoid this.
  */
-#if defined(HAVE_SETLOCALE)
-# include <locale.h>
-#endif
+#include <locale.h>
 
 #ifdef HAVE_LIBINTL_H
 
index d2727720e105f7bc230bda11d6e8b3b96c4c5ece..d0b72dcb94b057cb0f51cb3fb163aa1c63f7e999 100644 (file)
@@ -49,7 +49,6 @@ sudoers_getlocale(void)
  * If prevlocale is non-NULL it will be filled in with the
  * old SUDOERS_LOCALE_* value.
  */
-#ifdef HAVE_SETLOCALE
 bool
 sudoers_setlocale(int newlocale, int *prevlocale)
 {
@@ -82,19 +81,3 @@ sudoers_setlocale(int newlocale, int *prevlocale)
     }
     return res ? true : false;
 }
-#else
-bool
-sudoers_setlocale(int newlocale, int *prevlocale)
-{
-    switch (newlocale) {
-       case SUDOERS_LOCALE_USER:
-       case SUDOERS_LOCALE_SUDOERS:
-           if (prevlocale)
-               *prevlocale = current_locale;
-           current_locale = newlocale;
-           return true;
-       default:
-           return false;
-    }
-}
-#endif /* HAVE_SETLOCALE */
index 4f011f8bd3c0e4b11fbf6260c88ecd557e544b4c..f03e73adb749911d6a09a07459bf64c28f3e588a 100644 (file)
@@ -552,9 +552,7 @@ init_vars(char * const envp[])
     (void) tzset();            /* set the timezone if applicable */
 #endif /* HAVE_TZSET */
 
-#ifdef HAVE_SETLOCALE
     user_locale = estrdup(setlocale(LC_ALL, NULL));
-#endif
 
     for (ep = envp; *ep; ep++) {
        /* XXX - don't fill in if empty string */
index 0f49c7e1ab164b7f9c7db6a5371aa34dbd86c22c..81c2c2c7bf5ae32e1423a503772ba525e049a34d 100644 (file)
@@ -242,7 +242,7 @@ main(int argc, char *argv[])
 {
     int ch, idx, plen, exitcode = 0, rows = 0, cols = 0;
     bool interactive = false, listonly = false, need_nlcr = false;
-    const char *id, *user = NULL, *pattern = NULL, *tty = NULL, *decimal = ".";
+    const char *decimal, *id, *user = NULL, *pattern = NULL, *tty = NULL;
     char path[PATH_MAX], buf[LINE_MAX], *cp, *ep;
     double seconds, to_wait, speed = 1.0, max_wait = 0;
     sigaction_t sa;
@@ -263,10 +263,8 @@ main(int argc, char *argv[])
     setprogname(argc > 0 ? argv[0] : "sudoreplay");
 #endif
 
-#ifdef HAVE_SETLOCALE
     setlocale(LC_ALL, "");
     decimal = localeconv()->decimal_point;
-#endif
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have sudoreplay domain */
     textdomain("sudoers");
 
index 109eaa3d0f22000c2a79b0e86464dcb3bc7028f7..81498b011d5f9c7894052043617efea16fa5787c 100644 (file)
@@ -148,9 +148,7 @@ main(int argc, char *argv[])
     setprogname(argc > 0 ? argv[0] : "testsudoers");
 #endif
 
-#ifdef HAVE_SETLOCALE 
     setlocale(LC_ALL, "");
-#endif
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have own domain */
     textdomain("sudoers");
 
index 6df0d3fa9ddccc6e53f2bfa257f4601af5c54240..ba8c5938e461eb18d50579c0de6c297dab4cf920 100644 (file)
@@ -161,9 +161,7 @@ main(int argc, char *argv[])
     setprogname(argc > 0 ? argv[0] : "visudo");
 #endif
 
-#ifdef HAVE_SETLOCALE 
     setlocale(LC_ALL, "");
-#endif
     bindtextdomain("sudoers", LOCALEDIR); /* XXX - should have visudo domain */
     textdomain("sudoers");
 
index 6502df98df9186e23cfd5f176c072cfee5fccc0e..d41fb5106e57516cfc7e9bcd92c5375898f8d82d 100644 (file)
@@ -105,13 +105,11 @@ static void
 _warning(int use_errno, const char *fmt, va_list ap)
 {
     int serrno = errno;
-#ifdef HAVE_SETLOCALE
     char *prev_locale = estrdup(setlocale(LC_ALL, NULL));
 
     /* Set locale to user's if different. */
     if (*prev_locale != '\0')
        setlocale(LC_ALL, "");
-#endif
 
     fputs(getprogname(), stderr);
     if (fmt != NULL) {
@@ -124,10 +122,8 @@ _warning(int use_errno, const char *fmt, va_list ap)
     }
     putc('\n', stderr);
 
-#ifdef HAVE_SETLOCALE
     /* Restore locale if needed. */
     if (*prev_locale != '\0')
        setlocale(LC_ALL, prev_locale);
     efree(prev_locale);
-#endif
 }
index 808ed30bf1ff2927605198396637e35dbca6ab76..7dd36ff7cd3ba9d3d42193c8b0db84732b1f5cff 100644 (file)
@@ -346,13 +346,11 @@ sudo_execute(struct command_details *details, struct command_status *cstat)
     if (ISSET(details->flags, CD_SET_TIMEOUT))
        alarm(details->timeout);
 
-#ifdef HAVE_SETLOCALE
     /*
      * I/O logging must be in the C locale for floating point numbers
      * to be logged consistently.
      */
     setlocale(LC_ALL, "C");
-#endif
 
     /*
      * In the event loop we pass input from user tty to master
index c6e41da907cfe349aa79fa2850883d5829e72f92..1de8ba03b9c27f9c823b3f7ed74444f8440f2535 100644 (file)
@@ -60,9 +60,7 @@ main(int argc, char *argv[], char *envp[])
     int noexec = 0;
     debug_decl(main, SUDO_DEBUG_MAIN)
 
-#ifdef HAVE_SETLOCALE 
     setlocale(LC_ALL, "");
-#endif
     bindtextdomain(PACKAGE_NAME, LOCALEDIR);
     textdomain(PACKAGE_NAME);
 
index ec82a141f887649228f30a71c45c914db1443167..01161a4f93afc3234bd3294babbe14349dbeeca5 100644 (file)
@@ -153,9 +153,7 @@ main(int argc, char *argv[], char *envp[])
 
     os_init(argc, argv, envp);
 
-#ifdef HAVE_SETLOCALE
     setlocale(LC_ALL, "");
-#endif
     bindtextdomain(PACKAGE_NAME, LOCALEDIR);
     textdomain(PACKAGE_NAME);