ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
923a60
From 94fec84897ab40bf2bc92f0d395a93ecac1b45be Mon Sep 17 00:00:00 2001
923a60
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Nykr=C3=BDn?= <lnykryn@redhat.com>
923a60
Date: Wed, 3 Aug 2016 17:08:37 +0200
923a60
Subject: [PATCH] systemctl: consider service running only when it is in active
923a60
 or reloading state (#3874)
923a60
923a60
Otherwise for example services that are failing on start and have Restart=on-failure
923a60
and bigger RestartSec systemctl status will return 0.
923a60
923a60
Fixes: #3864
923a60
Cherry-picked from: 7f5da8bd4fb1ba49ba40195a74ca76bb5d4d1f81
923a60
Resolves: #1362461
923a60
---
923a60
 src/systemctl/systemctl.c | 2 +-
923a60
 1 file changed, 1 insertion(+), 1 deletion(-)
923a60
923a60
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
923a60
index 93b7a193b2..b7496c006e 100644
923a60
--- a/src/systemctl/systemctl.c
923a60
+++ b/src/systemctl/systemctl.c
923a60
@@ -4339,7 +4339,7 @@ static int show_one(
923a60
         else if (streq(verb, "status")) {
923a60
                 print_status_info(&info, ellipsized);
923a60
 
923a60
-                if (info.active_state && STR_IN_SET(info.active_state, "inactive", "failed"))
923a60
+                if (info.active_state && !STR_IN_SET(info.active_state, "active", "reloading"))
923a60
                         r = EXIT_PROGRAM_NOT_RUNNING;
923a60
                 else
923a60
                         r = EXIT_PROGRAM_RUNNING_OR_SERVICE_OK;