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;
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]));