From 5e6abd3a2888d4a47428c0232d1f823cd03e29ad Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 25 Oct 2010 17:34:10 +0100 Subject: [PATCH] master: Use env_clean_except() instead of doing it ourself. --- src/master/main.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/master/main.c b/src/master/main.c index 9a2fbed393..5e390d6bec 100644 --- a/src/master/main.c +++ b/src/master/main.c @@ -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])); -- 2.47.3