Mercurial > dovecot > original-hg > dovecot-1.2
changeset 7807:8704bd29617b HEAD
env_clean(): calloc() is probably the safest way to do it.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 10 Jun 2008 20:28:48 +0300 |
parents | 5ae1c7c4edcf |
children | 9185f2adeefb |
files | src/lib/env-util.c |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib/env-util.c Tue Jun 10 07:27:19 2008 +0300 +++ b/src/lib/env-util.c Tue Jun 10 20:28:48 2008 +0300 @@ -24,15 +24,15 @@ i_fatal("clearenv() failed"); #else extern char **environ; - static char *emptyenv[1] = { 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. + c) environ = emptyenv doesn't work on Haiku OS + d) environ = calloc() should work everywhere */ - environ = emptyenv; + environ = calloc(1, sizeof(*environ)); #endif /* don't clear the env_pool, otherwise the environment would get corrupted if we failed to clear it. */