From: Yu Watanabe Date: Wed, 16 Apr 2025 18:03:53 +0000 (+0900) Subject: test: allow to allocate test scope even running with unprivileged user X-Git-Tag: v258-rc1~653^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F37151%2Fhead;p=thirdparty%2Fsystemd.git test: allow to allocate test scope even running with unprivileged user --- diff --git a/src/shared/tests.c b/src/shared/tests.c index 06f26a2222a..03ec3ba15eb 100644 --- a/src/shared/tests.c +++ b/src/shared/tests.c @@ -219,7 +219,10 @@ static int allocate_scope(void) { return 0; } - r = sd_bus_default_system(&bus); + if (geteuid() == 0) + r = sd_bus_default_system(&bus); + else + r = sd_bus_default_user(&bus); if (r < 0) return log_error_errno(r, "Failed to connect to system bus: %m");