1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-06 16:59:03 +03:00

main: when reloading PID 1 let's reset the default environment

Otherwise we keep collecting stuff from env generators, and we really
shouldn't.

This was working properly on reexec but not on reload, as for reexec we
would always start fresh, but for reload would reuse the Manager object
and hence its default environment set.

Fixes: #10671
This commit is contained in:
Lennart Poettering 2018-11-19 12:23:13 +01:00
parent 2fbbbf9a5f
commit 79a224c460
3 changed files with 6 additions and 3 deletions

View File

@ -767,8 +767,10 @@ static void set_manager_defaults(Manager *m) {
m->default_tasks_accounting = arg_default_tasks_accounting;
m->default_tasks_max = arg_default_tasks_max;
manager_set_default_rlimits(m, arg_default_rlimit);
manager_transient_environment_add(m, arg_default_environment);
(void) manager_set_default_rlimits(m, arg_default_rlimit);
(void) manager_default_environment(m);
(void) manager_transient_environment_add(m, arg_default_environment);
}
static void set_manager_settings(Manager *m) {

View File

@ -600,7 +600,7 @@ static char** sanitize_environment(char **l) {
return l;
}
static int manager_default_environment(Manager *m) {
int manager_default_environment(Manager *m) {
assert(m);
m->transient_environment = strv_free(m->transient_environment);

View File

@ -442,6 +442,7 @@ void manager_clear_jobs(Manager *m);
unsigned manager_dispatch_load_queue(Manager *m);
int manager_default_environment(Manager *m);
int manager_transient_environment_add(Manager *m, char **plus);
int manager_client_environment_modify(Manager *m, char **minus, char **plus);
int manager_get_effective_environment(Manager *m, char ***ret);