dovecot-1.2: env_clean(): Try yet another way that appears to wo...
dovecot at dovecot.org
dovecot at dovecot.org
Tue Jun 10 07:27:23 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/5ae1c7c4edcf
changeset: 7806:5ae1c7c4edcf
user: Timo Sirainen <tss at iki.fi>
date: Tue Jun 10 07:27:19 2008 +0300
description:
env_clean(): Try yet another way that appears to work better.
diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
src/lib/env-util.c | 12 +++++++-----
diffs (24 lines):
diff -r d440b7cad709 -r 5ae1c7c4edcf src/lib/env-util.c
--- a/src/lib/env-util.c Mon Jun 09 22:02:02 2008 +0300
+++ b/src/lib/env-util.c Tue Jun 10 07:27:19 2008 +0300
@@ -24,13 +24,15 @@ void env_clean(void)
i_fatal("clearenv() failed");
#else
extern char **environ;
+ static char *emptyenv[1] = { NULL };
- /* Try to clear the environment. It should always be non-NULL, but
- apparently it's not on some ancient OSes (Ultrix), so just keep
- the check. The clearing also fails on FreeBSD 7.0 (currently). */
- if (environ != NULL)
- *environ = NULL;
+ /* Try to clear the environment.
+ a) environ = NULL crashes on OS X.
+ b) *environ = NULL doesn't work on FreeBSD 7.0.
+ c) environ = emptyenv appears to work everywhere.
+ */
+ environ = emptyenv;
#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