From: Timo Sirainen Date: Mon, 25 Oct 2010 16:34:10 +0000 (+0100) Subject: master: Use env_clean_except() instead of doing it ourself. X-Git-Tag: 2.0.7~51 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5e6abd3a2888d4a47428c0232d1f823cd03e29ad;p=thirdparty%2Fdovecot%2Fcore.git master: Use env_clean_except() instead of doing it ourself. --- 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]));