mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
systemctl: conform to LSB with the "status" return code
check for pid file existance before returning 1
This commit is contained in:
parent
aed63d6758
commit
3b05b8b3b5
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user