user-util: add new uid_is_system() helper
This adds uid_is_system() and gid_is_system(), similar in style to uid_is_dynamic(). That a helper like this is useful is illustrated by the fact that test-condition.c didn't get the check right so far, which this patch fixes.
This commit is contained in:
@@ -391,7 +391,7 @@ static void test_condition_test_user(void) {
|
||||
assert_se(condition);
|
||||
r = condition_test(condition);
|
||||
log_info("ConditionUser=@system → %i", r);
|
||||
if (getuid() < SYSTEM_UID_MAX || geteuid() < SYSTEM_UID_MAX)
|
||||
if (uid_is_system(getuid()) || uid_is_system(geteuid()))
|
||||
assert_se(r > 0);
|
||||
else
|
||||
assert_se(r == 0);
|
||||
|
||||
Reference in New Issue
Block a user