summaryrefslogtreecommitdiff
path: root/src/test/test-util.c
diff options
context:
space:
mode:
authorJakub Filak <jfilak@redhat.com>2014-11-25 07:37:47 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-11-27 00:24:52 -0500
commitc593bb360edd96fa6cd42f09e934f76c94f84473 (patch)
tree2fb97096941305f141ab01e1739f263f1414dcc7 /src/test/test-util.c
parent59580681f5f950335b5ec40bb4c4a70dca6b2830 (diff)
util: add function getting proc environ
On the contrary of env, the added function returns all characters cescaped, because it improves reproducibility.
Diffstat (limited to 'src/test/test-util.c')
-rw-r--r--src/test/test-util.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test-util.c b/src/test/test-util.c
index b33e15aef..1602aa639 100644
--- a/src/test/test-util.c
+++ b/src/test/test-util.c
@@ -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);