]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
env_clean(): calloc() is probably the safest way to do it.
authorTimo Sirainen <tss@iki.fi>
Tue, 10 Jun 2008 17:28:48 +0000 (20:28 +0300)
committerTimo Sirainen <tss@iki.fi>
Tue, 10 Jun 2008 17:28:48 +0000 (20:28 +0300)
--HG--
branch : HEAD

src/lib/env-util.c

index e8b178561bf671060604f7cf119d1857d88b9a1e..52721e5f15e7acdf1e8f4f5eec918c338daaf15c 100644 (file)
@@ -24,15 +24,15 @@ void env_clean(void)
                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. */