daandemeyer / rpms / systemd

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