ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
8be66a
From 91c83bde0904581fbc33eb7821119e665b9505ce Mon Sep 17 00:00:00 2001
8be66a
From: Filipe Brandenburger <filbranden@google.com>
8be66a
Date: Fri, 20 Jul 2018 11:32:55 -0700
8be66a
Subject: [PATCH] systemctl: Only wait when there's something to wait for.
8be66a
8be66a
Tested:
8be66a
- `systemctl --wait start i-do-not-exist.service` does not wait.
8be66a
- `systemctl --wait start i-do-not-exist.service valid-unit.service` does.
8be66a
8be66a
(cherry picked from commit 46f2579c2ac9f6780d5afec1000764defc6b581e)
8be66a
8be66a
Related: #846319
8be66a
---
8be66a
 src/systemctl/systemctl.c | 2 +-
8be66a
 1 file changed, 1 insertion(+), 1 deletion(-)
8be66a
8be66a
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
8be66a
index f057dc829c..1929692480 100644
8be66a
--- a/src/systemctl/systemctl.c
8be66a
+++ b/src/systemctl/systemctl.c
8be66a
@@ -3130,7 +3130,7 @@ static int start_unit(int argc, char *argv[], void *userdata) {
8be66a
                                 check_triggering_units(bus, *name);
8be66a
         }
8be66a
 
8be66a
-        if (r >= 0 && arg_wait) {
8be66a
+        if (r >= 0 && arg_wait && !set_isempty(wait_context.unit_paths)) {
8be66a
                 int q;
8be66a
                 q = sd_event_loop(wait_context.event);
8be66a
                 if (q < 0)