]> git.ipfire.org Git - thirdparty/systemd.git/commit
activate: simplify/rework implementation of --setenv 20419/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 Aug 2021 15:58:17 +0000 (17:58 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 11 Aug 2021 08:17:50 +0000 (10:17 +0200)
commit76e68b3db35fab05940496b45cf9681dc7707db5
treed4daa6bd8c18f95d00bef87729901a8b1ec8d457
parent2f400671da769b996e9b7fd6d20b1cba74f84148
activate: simplify/rework implementation of --setenv

Previous implementation is simplified by using the new helper. The new code
does more looping, but considering that it's unlikely that people set more
than a handful of variables through commandline options, this should be OK.

If a variable is specified on the command line, it overrides any automatically
set variable. Effective behaviour was already were like this, because we would
specify two variables, both would be set, and since glibc will return
the first matching entry.
('systemd-socket-activate -E TERM=FOO -l 2000 --inetd -a env' would give
'TERM=FOO TERM=xterm-256color PATH=...', and getenv("TERM") returns "FOO".)
But it's nicer to filter out any duplicate entries and only pass the intended
variable to the child process.
src/activate/activate.c