From 45fea137f90850b356af7c77c757a39445d7fe17 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 18 Jun 2012 13:47:01 -0400 Subject: [PATCH] Fix compilation on gcc 2.95 and other compilers that only allow variable declarations at the beginning of a block. --- plugins/sudoers/logging.c | 4 +++- plugins/sudoers/sudoreplay.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index 4d3e13e47..1f4fc6ac8 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -130,10 +130,12 @@ do_syslog(int pri, char *msg) size_t len, maxlen; char *p, *tmp, save; const char *fmt; +#ifdef HAVE_SETLOCALE + const char *old_locale = estrdup(setlocale(LC_ALL, NULL)); +#endif debug_decl(do_syslog, SUDO_DEBUG_LOGGING) #ifdef HAVE_SETLOCALE - const char *old_locale = estrdup(setlocale(LC_ALL, NULL)); if (!setlocale(LC_ALL, def_sudoers_locale)) setlocale(LC_ALL, "C"); #endif /* HAVE_SETLOCALE */ diff --git a/plugins/sudoers/sudoreplay.c b/plugins/sudoers/sudoreplay.c index bcd6304f9..2abbf1b7c 100644 --- a/plugins/sudoers/sudoreplay.c +++ b/plugins/sudoers/sudoreplay.c @@ -535,9 +535,10 @@ delay(double secs) static int open_io_fd(char *path, int len, const char *suffix, union io_fd *fdp) { + debug_decl(open_io_fd, SUDO_DEBUG_UTIL) + path[len] = '\0'; strlcat(path, suffix, PATH_MAX); - debug_decl(open_io_fd, SUDO_DEBUG_UTIL) #ifdef HAVE_ZLIB_H fdp->g = gzopen(path, "r"); -- 2.40.0