Skip to content

Commit

Permalink
lib-master: Use master_service_import_environment() for preserving en…
Browse files Browse the repository at this point in the history
…vironments
  • Loading branch information
sirainen committed Sep 14, 2017
1 parent caac938 commit 63eb42b
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/lib-master/master-service-settings.c
Expand Up @@ -123,25 +123,18 @@ 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;
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");
Expand Down

0 comments on commit 63eb42b

Please sign in to comment.