dovecot-1.1: Use clearenv() if available.

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 9 21:25:26 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/60361212bf20
changeset: 7623:60361212bf20
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 09 21:24:51 2008 +0300
description:
Use clearenv() if available.

diffstat:

2 files changed, 6 insertions(+), 1 deletion(-)
configure.in       |    2 +-
src/lib/env-util.c |    5 +++++

diffs (34 lines):

diff -r c2747ab1696e -r 60361212bf20 configure.in
--- a/configure.in	Mon Jun 09 19:05:29 2008 +0300
+++ b/configure.in	Mon Jun 09 21:24:51 2008 +0300
@@ -430,7 +430,7 @@ AC_CHECK_FUNCS(fcntl flock lockf inet_at
                strcasecmp stricmp vsyslog writev pread \
 	       setrlimit setproctitle seteuid setreuid setegid setresgid \
 	       strtoull strtouq setpriority quotactl getmntent kqueue kevent \
-	       backtrace_symbols walkcontext dirfd \
+	       backtrace_symbols walkcontext dirfd clearenv \
 	       malloc_usable_size)
 
 dnl * I/O loop function
diff -r c2747ab1696e -r 60361212bf20 src/lib/env-util.c
--- a/src/lib/env-util.c	Mon Jun 09 19:05:29 2008 +0300
+++ b/src/lib/env-util.c	Mon Jun 09 21:24:51 2008 +0300
@@ -19,6 +19,10 @@ void env_put(const char *env)
 
 void env_clean(void)
 {
+#ifdef HAVE_CLEARENV
+	if (clearenv() < 0)
+		i_fatal("clearenv() failed");
+#else
 	extern char **environ;
 
 	/* Try to clear the environment. It should always be non-NULL, but
@@ -27,6 +31,7 @@ void env_clean(void)
 	if (environ != NULL)
 		*environ = NULL;
 
+#endif
 	/* don't clear the env_pool, otherwise the environment would get
 	   corrupted if we failed to clear it. */
 }


More information about the dovecot-cvs mailing list