pid1: restore the original environment passed by the kernel when switching to a new system manager

PID1 may modified the environment passed by the kernel when it starts
running. Commit 9d48671c62 unset $HOME for
example.

In case PID1 is going to switch to a new root and execute a new system manager
which is not systemd, we should restore the original environment as the new
manager might expect some variables to be set by default (more specifically
$HOME).
This commit is contained in:
Franck Bui
2019-10-03 22:08:13 +02:00
committed by Zbigniew Jędrzejewski-Szmek
parent 694566454a
commit a5cede8c24
3 changed files with 17 additions and 2 deletions
+3
View File
@@ -13,6 +13,9 @@ static inline void save_argc_argv(int argc, char **argv) {
saved_argv = argv;
}
extern char **saved_env;
void save_env(void);
bool kexec_loaded(void);
int prot_from_flags(int flags) _const_;