mirror of
https://github.com/troglobit/finit.git
synced 2026-11-18 19:30:56 +00:00
service_unregister(): Refactor, simplify and set #ifdef correctly
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
7d444e07a5
commit
1269f082de
1 file changed
+13
-8
+13
-8
@@ -897,21 +897,26 @@ void service_unregister(svc_t *svc)
|
|||||||
* Only try stopping @svc if it's *not* an inetd connection.
|
* Only try stopping @svc if it's *not* an inetd connection.
|
||||||
* Prevents infinite recursion when called from service_step()
|
* Prevents infinite recursion when called from service_step()
|
||||||
*/
|
*/
|
||||||
if (!svc_is_inetd_conn(svc))
|
switch (svc->type) {
|
||||||
service_stop(svc);
|
#ifdef INETD_ENABLED
|
||||||
else {
|
case SVC_TYPE_INETD:
|
||||||
|
inetd_del(&svc->inetd);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SVC_TYPE_INETD_CONN:
|
||||||
/* inetd connection, if UDP unblock parent */
|
/* inetd connection, if UDP unblock parent */
|
||||||
if (svc_is_busy(svc->inetd.svc)) {
|
if (svc_is_busy(svc->inetd.svc)) {
|
||||||
svc_unblock(svc->inetd.svc);
|
svc_unblock(svc->inetd.svc);
|
||||||
service_step(svc->inetd.svc);
|
service_step(svc->inetd.svc);
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
#ifdef INETD_ENABLED
|
|
||||||
if (svc_is_inetd(svc))
|
|
||||||
inetd_del(&svc->inetd);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
default:
|
||||||
|
service_stop(svc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
svc_del(svc);
|
svc_del(svc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user