dovecot-2.0: lib-master: Use env_clean_except() for master_servi...

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 25 19:34:15 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/e0a97842182f
changeset: 12348:e0a97842182f
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 25 17:31:39 2010 +0100
description:
lib-master: Use env_clean_except() for master_service_env_clean()

diffstat:

 src/lib-master/master-service.c |  24 +-----------------------
 1 files changed, 1 insertions(+), 23 deletions(-)

diffs (34 lines):

diff -r fe72469ccdf5 -r e0a97842182f src/lib-master/master-service.c
--- a/src/lib-master/master-service.c	Mon Oct 25 17:31:01 2010 +0100
+++ b/src/lib-master/master-service.c	Mon Oct 25 17:31:39 2010 +0100
@@ -402,29 +402,7 @@
 #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,


More information about the dovecot-cvs mailing list