]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Use clearenv() if available.
authorTimo Sirainen <tss@iki.fi>
Mon, 9 Jun 2008 18:25:21 +0000 (21:25 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 9 Jun 2008 18:25:21 +0000 (21:25 +0300)
--HG--
branch : HEAD

configure.in
src/lib/env-util.c

index 807c5e4e5ce1f034167eb739160b5938cd67e659..23fa3a42f232c86f2a4a29d399ea0ff733b85667 100644 (file)
@@ -430,7 +430,7 @@ AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
                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
index e1bc683541a9136f38d1b0f00af6d94194ebcee0..e4ed8956809aa57fe85ce42d66787f49b02b9024 100644 (file)
@@ -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. */
 }