mirror of
https://github.com/systemd/systemd.git
synced 2025-01-25 10:04:04 +03:00
test-process-util: Ignore EINVAL from setresuid() and setresgid()
If we're running in a user namespace with a single user and without the nobody user, we'll get EINVAL from these system calls so make sure we handle those gracefully.
This commit is contained in:
parent
34a7ca6db2
commit
e5c6dcac87
@ -729,11 +729,13 @@ TEST(setpriority_closest) {
|
||||
/* However, if the hard limit was above 30, setrlimit would succeed unprivileged, so
|
||||
* check if the UID/GID can be changed before enabling the full test. */
|
||||
if (setresgid(GID_NOBODY, GID_NOBODY, GID_NOBODY) < 0) {
|
||||
if (!ERRNO_IS_PRIVILEGE(errno))
|
||||
/* If the nobody user does not exist (user namespace) we get EINVAL. */
|
||||
if (!ERRNO_IS_PRIVILEGE(errno) && errno != EINVAL)
|
||||
ASSERT_OK_ERRNO(-1);
|
||||
full_test = false;
|
||||
} else if (setresuid(UID_NOBODY, UID_NOBODY, UID_NOBODY) < 0) {
|
||||
if (!ERRNO_IS_PRIVILEGE(errno))
|
||||
/* If the nobody user does not exist (user namespace) we get EINVAL. */
|
||||
if (!ERRNO_IS_PRIVILEGE(errno) && errno != EINVAL)
|
||||
ASSERT_OK_ERRNO(-1);
|
||||
full_test = false;
|
||||
} else
|
||||
|
Loading…
x
Reference in New Issue
Block a user