]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: allow to allocate test scope even running with unprivileged user 37151/head
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 16 Apr 2025 18:03:53 +0000 (03:03 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 9 May 2025 15:17:52 +0000 (00:17 +0900)
src/shared/tests.c

index 06f26a2222af48a039f8b22ff22813a49dde177e..03ec3ba15ebffe334f911e86cf86a7913d7d20ae 100644 (file)
@@ -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");