ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
Blob Blame History Raw
From 8864ff594b43a34e5a593da42336f28e2f30b9f5 Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsateler@users.noreply.github.com>
Date: Wed, 19 Jul 2017 20:48:23 -0400
Subject: [PATCH] test-condition: don't assume that all non-root users are
 normal users (#6409)

Automated builders may run under a dedicated system user, and this test would fail that

Fixes #6366

(cherry picked from commit 708d423915c4ea48d408b5a3395c11055247b9bc)
---
 src/test/test-condition.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test-condition.c b/src/test/test-condition.c
index 121345cfd1..b15f1b98c0 100644
--- a/src/test/test-condition.c
+++ b/src/test/test-condition.c
@@ -390,7 +390,7 @@ static void test_condition_test_user(void) {
         assert_se(condition);
         r = condition_test(condition);
         log_info("ConditionUser=@system → %i", r);
-        if (geteuid() == 0)
+        if (getuid() < SYSTEM_UID_MAX || geteuid() < SYSTEM_UID_MAX)
                 assert_se(r > 0);
         else
                 assert_se(r == 0);