From a5cede8c24fddda9b73f142e09b18b49adde1b9c Mon Sep 17 00:00:00 2001 From: Franck Bui Date: Tue, 1 Oct 2019 14:31:14 +0200 Subject: 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 9d48671c62de133a2b9fe7c31e70c0ff8e68f2db 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). --- src/basic/util.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/basic/util.h') diff --git a/src/basic/util.h b/src/basic/util.h index 6fc7480fcb..15444b2e5c 100644 --- a/src/basic/util.h +++ b/src/basic/util.h @@ -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_; -- cgit v1.2.1