]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-master: Use master_service_import_environment() for preserving environments
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 7 Jun 2017 21:35:08 +0000 (00:35 +0300)
committerGitLab <gitlab@git.dovecot.net>
Sat, 10 Jun 2017 08:35:40 +0000 (11:35 +0300)
src/lib-master/master-service-settings.c

index 0902d4acbaf905f79deb959a37ea3c54ec7ec90a..5161645016ae8a83d046a15b567575bd733a55d8 100644 (file)
@@ -123,7 +123,7 @@ master_service_exec_config(struct master_service *service,
                           const struct master_service_settings_input *input)
 {
        const char **conf_argv, *binary_path = service->argv[0];
-       const char *home = NULL, *user = NULL, *timestamp = NULL, *error = NULL;
+       const char *error = NULL;
        unsigned int i, argv_max_count;
 
        if (!t_binary_abspath(&binary_path, &error)) {
@@ -132,18 +132,12 @@ master_service_exec_config(struct master_service *service,
 
        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");