changeset 22489:bca86353ccd5

lib-master: Use master_service_import_environment() for preserving environments
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Thu, 08 Jun 2017 00:35:08 +0300
parents 052396bac097
children 48772f0423cd
files src/lib-master/master-service-settings.c
diffstat 1 files changed, 3 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-master/master-service-settings.c	Thu Jun 08 00:33:32 2017 +0300
+++ b/src/lib-master/master-service-settings.c	Thu Jun 08 00:35:08 2017 +0300
@@ -123,25 +123,18 @@
 			   const struct master_service_settings_input *input)
 {
 	const char **conf_argv, *binary_path = service->argv[0];
-	const char *home = NULL, *user = NULL, *timestamp = NULL;
 	unsigned int i, argv_max_count;
 
 	(void)t_binary_abspath(&binary_path);
 
 	if (!service->keep_environment && !input->preserve_environment) {
 		if (input->preserve_home)
-			home = getenv("HOME");
+			master_service_import_environment("HOME");
 		if (input->preserve_user)
-			user = getenv("USER");
+			master_service_import_environment("USER");
 		if ((service->flags & MASTER_SERVICE_FLAG_STANDALONE) != 0)
-			timestamp = getenv("LOG_STDERR_TIMESTAMP");
+			master_service_import_environment("LOG_STDERR_TIMESTAMP");
 		master_service_env_clean();
-		if (home != NULL)
-			env_put(t_strconcat("HOME=", home, NULL));
-		if (user != NULL)
-			env_put(t_strconcat("USER=", user, NULL));
-		if (timestamp != NULL)
-			env_put(t_strconcat("LOG_STDERR_TIMESTAMP=", timestamp, NULL));
 	}
 	if (input->use_sysexits)
 		env_put("USE_SYSEXITS=1");