mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
Merge pull request #26579 from poettering/manager-env-clean-up
service manager env var clean-up fixes
This commit is contained in:
commit
0a75dca1cc
@ -3755,6 +3755,15 @@ StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZX
|
|||||||
system.</para></listitem>
|
system.</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><varname>$REMOTE_ADDR</varname></term>
|
||||||
|
<term><varname>$REMOTE_PORT</varname></term>
|
||||||
|
|
||||||
|
<listitem><para>If this is a unit started via per-connection socket activation (i.e. via a socket
|
||||||
|
unit with <varname>Accept=yes</varname>), these environment variables contain the IP address and
|
||||||
|
port number of the remote peer of the socket connection.</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><varname>$TRIGGER_UNIT</varname></term>
|
<term><varname>$TRIGGER_UNIT</varname></term>
|
||||||
<term><varname>$TRIGGER_PATH</varname></term>
|
<term><varname>$TRIGGER_PATH</varname></term>
|
||||||
|
@ -635,8 +635,14 @@ static char** sanitize_environment(char **l) {
|
|||||||
"LISTEN_FDS",
|
"LISTEN_FDS",
|
||||||
"LISTEN_PID",
|
"LISTEN_PID",
|
||||||
"LOGS_DIRECTORY",
|
"LOGS_DIRECTORY",
|
||||||
|
"LOG_NAMESPACE",
|
||||||
"MAINPID",
|
"MAINPID",
|
||||||
"MANAGERPID",
|
"MANAGERPID",
|
||||||
|
"MONITOR_EXIT_CODE",
|
||||||
|
"MONITOR_EXIT_STATUS",
|
||||||
|
"MONITOR_INVOCATION_ID",
|
||||||
|
"MONITOR_SERVICE_RESULT",
|
||||||
|
"MONITOR_UNIT",
|
||||||
"NOTIFY_SOCKET",
|
"NOTIFY_SOCKET",
|
||||||
"PIDFILE",
|
"PIDFILE",
|
||||||
"REMOTE_ADDR",
|
"REMOTE_ADDR",
|
||||||
@ -644,6 +650,11 @@ static char** sanitize_environment(char **l) {
|
|||||||
"RUNTIME_DIRECTORY",
|
"RUNTIME_DIRECTORY",
|
||||||
"SERVICE_RESULT",
|
"SERVICE_RESULT",
|
||||||
"STATE_DIRECTORY",
|
"STATE_DIRECTORY",
|
||||||
|
"SYSTEMD_EXEC_PID",
|
||||||
|
"TRIGGER_PATH",
|
||||||
|
"TRIGGER_TIMER_MONOTONIC_USEC",
|
||||||
|
"TRIGGER_TIMER_REALTIME_USEC",
|
||||||
|
"TRIGGER_UNIT",
|
||||||
"WATCHDOG_PID",
|
"WATCHDOG_PID",
|
||||||
"WATCHDOG_USEC",
|
"WATCHDOG_USEC",
|
||||||
NULL);
|
NULL);
|
||||||
@ -660,13 +671,11 @@ int manager_default_environment(Manager *m) {
|
|||||||
m->transient_environment = strv_free(m->transient_environment);
|
m->transient_environment = strv_free(m->transient_environment);
|
||||||
|
|
||||||
if (MANAGER_IS_SYSTEM(m)) {
|
if (MANAGER_IS_SYSTEM(m)) {
|
||||||
/* The system manager always starts with a clean
|
/* The system manager always starts with a clean environment for its children. It does not
|
||||||
* environment for its children. It does not import
|
* import the kernel's or the parents' exported variables.
|
||||||
* the kernel's or the parents' exported variables.
|
|
||||||
*
|
*
|
||||||
* The initial passed environment is untouched to keep
|
* The initial passed environment is untouched to keep /proc/self/environ valid; it is used
|
||||||
* /proc/self/environ valid; it is used for tagging
|
* for tagging the init process inside containers. */
|
||||||
* the init process inside containers. */
|
|
||||||
m->transient_environment = strv_new("PATH=" DEFAULT_PATH);
|
m->transient_environment = strv_new("PATH=" DEFAULT_PATH);
|
||||||
if (!m->transient_environment)
|
if (!m->transient_environment)
|
||||||
return log_oom();
|
return log_oom();
|
||||||
@ -685,7 +694,6 @@ int manager_default_environment(Manager *m) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sanitize_environment(m->transient_environment);
|
sanitize_environment(m->transient_environment);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user