]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
master: Use env_clean_except() instead of doing it ourself.
authorTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 16:34:10 +0000 (17:34 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 16:34:10 +0000 (17:34 +0100)
src/master/main.c

index 9a2fbed39332190157e9da66f1ecc2084695f558..5e390d6becd09750c3dbab842048f2997d3a2e92 100644 (file)
@@ -598,6 +598,11 @@ static void print_build_options(void)
 
 int main(int argc, char *argv[])
 {
+       static const char *preserve_envs[] = {
+               /* AIX depends on TZ to get the timezone correctly. */
+               "TZ",
+               NULL
+       };
        struct master_settings *set;
        unsigned int child_process_env_idx = 0;
        const char *error, *env_tz, *doveconf_arg = NULL;
@@ -728,19 +733,13 @@ int main(int argc, char *argv[])
        master_settings_do_fixes(set);
        fatal_log_check(set);
 
-       /* save TZ environment. AIX depends on it to get the timezone
-          correctly. */
-       env_tz = getenv("TZ");
-
-       /* clean up the environment of everything */
-       env_clean();
+       /* clean up the environment */
+       env_clean_except(preserve_envs);
 
-       /* put back the TZ */
+       env_tz = getenv("TZ");
        if (env_tz != NULL) {
-               const char *env = t_strconcat("TZ=", env_tz, NULL);
-
-               env_put(env);
-               child_process_env[child_process_env_idx++] = env;
+               child_process_env[child_process_env_idx++] =
+                       t_strconcat("TZ=", env_tz, NULL);
        }
        i_assert(child_process_env_idx <
                 sizeof(child_process_env) / sizeof(child_process_env[0]));