summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2013-06-25 16:25:38 +0200
committerHarald Hoyer <harald@redhat.com>2013-06-25 16:28:00 +0200
commit3b05b8b3b503caf525fa72440a3f9f4bae75268b (patch)
tree54376839b32454f97ad52428982c1ac0f53dc624 /src/systemctl
parentaed63d6758ecfe9fa19aef861f4a9b4cef3a0806 (diff)
systemctl: conform to LSB with the "status" return code
check for pid file existance before returning 1
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 71bf17d475..24543ee06d 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -3550,7 +3550,7 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo
if (!streq_ptr(info.active_state, "active") &&
!streq_ptr(info.active_state, "reloading") &&
- streq(verb, "status"))
+ streq(verb, "status")) {
/* According to LSB: "program not running" */
/* 0: program is running or service is OK
* 1: program is dead and /var/run pid file exists
@@ -3558,10 +3558,11 @@ static int show_one(const char *verb, DBusConnection *bus, const char *path, boo
* 3: program is not running
* 4: program or service status is unknown
*/
- if (info.pid_file)
+ if (info.pid_file && access(info.pid_file, F_OK) == 0)
r = 1;
else
r = 3;
+ }
while ((p = info.exec)) {
LIST_REMOVE(ExecStatusInfo, exec, info.exec, p);