]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Use env_clean_except() for master_service_env_clean()
authorTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 16:31:39 +0000 (17:31 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 25 Oct 2010 16:31:39 +0000 (17:31 +0100)
src/lib-master/master-service.c

index cc0376c2f7fdbae6fc12d42bbf382194720cbc95..5724b7b43cba16c6fe0fe42ca5fa88f601f42d9a 100644 (file)
@@ -402,29 +402,7 @@ void master_service_env_clean(bool preserve_home)
 #endif
                NULL
        };
-       ARRAY_TYPE(const_string) envs;
-       const char *value, *const *envp;
-       unsigned int i;
-
-       t_array_init(&envs, N_ELEMENTS(preserve_envs));
-       i = preserve_home ? 0 : 1;
-       for (; preserve_envs[i] != NULL; i++) {
-               const char *key = preserve_envs[i];
-
-               value = getenv(key);
-               if (value != NULL) {
-                       value = t_strconcat(key, "=", value, NULL);
-                       array_append(&envs, &value, 1);
-               }
-       }
-
-       /* Note that if the original environment was set with env_put(), the
-          environment strings will be invalid after env_clean(). That's why
-          we t_strconcat() them above. */
-       env_clean();
-
-       array_foreach(&envs, envp)
-               env_put(*envp);
+       env_clean_except(preserve_envs + (preserve_home ? 0 : 1));
 }
 
 void master_service_set_client_limit(struct master_service *service,