mirror of
https://github.com/troglobit/finit.git
synced 2026-11-06 15:51:03 +00:00
Follow-up to ba2ab4b, crashing services may not have a PID rn
- Don't warn of missing PID, even if only _d(), perfectly normal - Allow stopping restart timer of non-services (e.g. task/run) - Allow stopping services with no PID rn, i.e. stop libuEv timer Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
b2b6fd25d8
commit
c64a71ff30
1 file changed
+4
-11
+4
-11
@@ -436,13 +436,8 @@ static int service_stop(svc_t *svc)
|
|||||||
#endif
|
#endif
|
||||||
service_timeout_cancel(svc);
|
service_timeout_cancel(svc);
|
||||||
|
|
||||||
if (svc->pid <= 1) {
|
if (svc->pid <= 1)
|
||||||
_d("Bad PID %d for %s, SIGTERM", svc->pid, svc->cmd);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
|
||||||
|
|
||||||
if (SVC_TYPE_SERVICE != svc->type)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
_d("Sending SIGTERM to pid:%d name:%s", svc->pid, pid_get_name(svc->pid, NULL, 0));
|
_d("Sending SIGTERM to pid:%d name:%s", svc->pid, pid_get_name(svc->pid, NULL, 0));
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
svc_set_state(svc, SVC_STOPPING_STATE);
|
||||||
@@ -858,12 +853,10 @@ void service_unregister(svc_t *svc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only call service_stop() if @svc is still running *and* it's
|
* Only try stopping @svc if it's *not* an inetd connection.
|
||||||
* not an inetd connection. This prevents infinite recursion if
|
* Prevents infinite recursion when called from service_step()
|
||||||
* called from service_step(), or if it's an inet connection and
|
|
||||||
* it's already been stopped.
|
|
||||||
*/
|
*/
|
||||||
if (svc->pid && !svc_is_inetd_conn(svc))
|
if (!svc_is_inetd_conn(svc))
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
|
|
||||||
if (svc_is_inetd(svc)) {
|
if (svc_is_inetd(svc)) {
|
||||||
|
|||||||
Reference in new issue
Block a user