diff options
author | Lennart Poettering <lennart@poettering.net> | 2019-11-01 11:26:05 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2019-11-01 11:30:59 +0100 |
commit | 0e06a03165bdec49c79d12043e690d8f3a672812 (patch) | |
tree | 023e6b804fc3d4ac9e1820b736bd937c9f7a2a1b /src/basic/util.c | |
parent | 6878c02245b49987749e73a12003fcf07bf173ca (diff) | |
download | systemd-0e06a03165bdec49c79d12043e690d8f3a672812.tar.gz |
pid1: rework environment block copy logic
This reworks the logic introduced in
a5cede8c24fddda9b73f142e09b18b49adde1b9c (#13693).
First of all, let's move this out of util.c, since only PID 1 really
needs this, and there's no real need to have it in util.c.
Then, fix freeing of the variable. It previously relied on
STATIC_DESTRUCTOR_REGISTER() which however relies on static_destruct()
to be called explicitly. Currently only the main-func.h macros do that,
and PID 1 does not. (It might be worth investigating whether to do that,
but it's not trivial.) Hence the freeing wasn't applied.
Finally, an OOM check was missing, add it in.
Diffstat (limited to 'src/basic/util.c')
-rw-r--r-- | src/basic/util.c | 8 |
1 files changed, 0 insertions, 8 deletions
diff --git a/src/basic/util.c b/src/basic/util.c index b02471c483..f74ed95a60 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -38,7 +38,6 @@ #include "set.h" #include "signal-util.h" #include "stat-util.h" -#include "static-destruct.h" #include "string-util.h" #include "strv.h" #include "time-util.h" @@ -49,11 +48,8 @@ int saved_argc = 0; char **saved_argv = NULL; -char **saved_env = NULL; static int saved_in_initrd = -1; -STATIC_DESTRUCTOR_REGISTER(saved_env, strv_freep); - bool kexec_loaded(void) { _cleanup_free_ char *s = NULL; @@ -301,7 +297,3 @@ void disable_coredumps(void) { if (r < 0) log_debug_errno(r, "Failed to turn off coredumps, ignoring: %m"); } - -void save_env(void) { - saved_env = strv_copy(environ); -} |