systemd/0013-test-condition-don-t-assume-that-all-non-root-users-.patch
Zbigniew Jędrzejewski-Szmek 27bd1bd49f Backport some patches
2017-07-31 15:52:44 -04:00

29 lines
1.0 KiB
Diff

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);