changeset 22488:052396bac097

lib-master: master_service_import_environment() - use a data stack frame This way the caller doesn't have to do it.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 08 Jun 2017 00:33:32 +0300
parents e60f0e893992
children bca86353ccd5
files src/lib-master/master-service.c src/master/main.c
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-master/master-service.c	Thu Jun 08 00:24:19 2017 +0300
+++ b/src/lib-master/master-service.c	Thu Jun 08 00:33:32 2017 +0300
@@ -551,7 +551,7 @@
 	master_status_update(service);
 }
 
-void master_service_import_environment(const char *import_environment)
+static void master_service_import_environment_real(const char *import_environment)
 {
 	const char *const *envs, *key, *value;
 	ARRAY_TYPE(const_string) keys;
@@ -582,6 +582,13 @@
 	env_put(t_strconcat(DOVECOT_PRESERVE_ENVS_ENV"=", value, NULL));
 }
 
+void master_service_import_environment(const char *import_environment)
+{
+	T_BEGIN {
+		master_service_import_environment_real(import_environment);
+	} T_END;
+}
+
 void master_service_env_clean(void)
 {
 	const char *value = getenv(DOVECOT_PRESERVE_ENVS_ENV);
--- a/src/master/main.c	Thu Jun 08 00:24:19 2017 +0300
+++ b/src/master/main.c	Thu Jun 08 00:33:32 2017 +0300
@@ -818,11 +818,9 @@
 	master_settings_do_fixes(set);
 	fatal_log_check(set);
 
-	T_BEGIN {
-		const struct master_service_settings *service_set =
-			master_service_settings_get(master_service);
-		master_service_import_environment(service_set->import_environment);
-	} T_END;
+	const struct master_service_settings *service_set =
+		master_service_settings_get(master_service);
+	master_service_import_environment(service_set->import_environment);
 	master_service_env_clean();
 
 	/* create service structures from settings. if there are any errors in