util: add function getting proc environ
On the contrary of env, the added function returns all characters cescaped, because it improves reproducibility.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
59580681f5
commit
c593bb360e
@@ -491,6 +491,7 @@ static void test_u64log2(void) {
|
||||
static void test_get_process_comm(void) {
|
||||
struct stat st;
|
||||
_cleanup_free_ char *a = NULL, *c = NULL, *d = NULL, *f = NULL, *i = NULL, *cwd = NULL, *root = NULL;
|
||||
_cleanup_free_ char *env = NULL;
|
||||
unsigned long long b;
|
||||
pid_t e;
|
||||
uid_t u;
|
||||
@@ -543,6 +544,10 @@ static void test_get_process_comm(void) {
|
||||
assert_se(r >= 0 || r == -EACCES);
|
||||
log_info("pid1 root: '%s'", root);
|
||||
|
||||
r = get_process_environ(me, &env);
|
||||
assert_se(r >= 0 || r == -EACCES);
|
||||
log_info("self strlen(environ): '%zd'", strlen(env));
|
||||
|
||||
assert_se(get_ctty_devnr(1, &h) == -ENOENT);
|
||||
|
||||
getenv_for_pid(1, "PATH", &i);
|
||||
|
||||
Reference in New Issue
Block a user