Merge pull request #13909 from poettering/env-copy-pid
Fixes for the "saved_env" copy logic
This commit is contained in:
@@ -40,8 +40,8 @@ typedef struct StaticDestructor {
|
||||
extern const struct StaticDestructor _weak_ __start_SYSTEMD_STATIC_DESTRUCT[];
|
||||
extern const struct StaticDestructor _weak_ __stop_SYSTEMD_STATIC_DESTRUCT[];
|
||||
|
||||
/* The function to destroy everything. (Note that this must be static inline, as it's key that it remains in the same
|
||||
* linking unit as the variables we want to destroy. */
|
||||
/* The function to destroy everything. (Note that this must be static inline, as it's key that it remains in
|
||||
* the same linking unit as the variables we want to destroy.) */
|
||||
static inline void static_destruct(void) {
|
||||
const StaticDestructor *d;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ 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_;
|
||||
|
||||
Reference in New Issue
Block a user