]> git.ipfire.org Git - thirdparty/util-linux.git/commit
env: save parsed variables into ul_env_list
authorKarel Zak <kzak@redhat.com>
Tue, 27 Aug 2024 11:07:56 +0000 (13:07 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 4 Sep 2024 11:39:03 +0000 (13:39 +0200)
commitaa789c1efcd28223308d010c830bc7f22c52927b
tree6a9a5391c955727b24fc955aef7d275d978ec8af
parent3489e86248361611db214a7b866cdc8e9b1d9a7a
env: save parsed variables into ul_env_list

The struct ul_env_list is currently only used to store the value of
env when sanitizing environ[]. It would be beneficial to also use the
functions related to ul_env_list for other purposes. In order to do
this, it is important to keep the NAME and VALUE components separate.

* Accept non-terminated name and value for env_list_add().

* Add env_list_add_from_string() to add item to the list from a
  "name=value" string.

* Add env_list_add_variable() to add item to the list using separate
  "name" and "value" strings.

* Update __sanitize_env() to use env_list_add_from_string().

* Modify the test to use "abc" as the value instead of copying the
  variable name (with '=') to the value.

Signed-off-by: Karel Zak <kzak@redhat.com>
include/env.h
lib/env.c