test-process-util: do not assume PID 1 has UID=0

Gentoo's Portage package manager uses a PID namespace for process
isolation and cleanup. In this namespace, PID 1 has UID=250 (portage).

Bug: https://bugs.gentoo.org/674458
This commit is contained in:
Mike Gilbert 2019-01-20 11:32:45 -05:00 committed by Lennart Poettering
parent 78218e6243
commit f356aabe98

View file

@ -70,11 +70,9 @@ static void test_get_process_comm(pid_t pid) {
assert_se(get_process_uid(pid, &u) == 0);
log_info("PID"PID_FMT" UID: "UID_FMT, pid, u);
assert_se(u == 0 || pid != 1);
assert_se(get_process_gid(pid, &g) == 0);
log_info("PID"PID_FMT" GID: "GID_FMT, pid, g);
assert_se(g == 0 || pid != 1);
r = get_process_environ(pid, &env);
assert_se(r >= 0 || r == -EACCES);