mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
Stop inetd watcher and close socket when inetd service is removed
This patch fixes a problem with lingering inet sockets when inetd services are removed. When removing an inetd service we must stop the watcher and close the socket. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
80624d3ff8
commit
448a9e1198
1 file changed
+6
-6
@@ -275,7 +275,9 @@ void inetd_stop(inetd_t *inetd)
|
|||||||
/* For dgram inetd services we block the parent SVC
|
/* For dgram inetd services we block the parent SVC
|
||||||
* and halt the watcher, so don't close the socket! */
|
* and halt the watcher, so don't close the socket! */
|
||||||
if (inetd->svc->block != SVC_BLOCK_INETD_BUSY) {
|
if (inetd->svc->block != SVC_BLOCK_INETD_BUSY) {
|
||||||
shutdown(inetd->watcher.fd, SHUT_RDWR);
|
_d("Shutting down inet socket %d ...", inetd->watcher.fd);
|
||||||
|
if (inetd->type == SOCK_STREAM)
|
||||||
|
shutdown(inetd->watcher.fd, SHUT_RDWR);
|
||||||
close(inetd->watcher.fd);
|
close(inetd->watcher.fd);
|
||||||
inetd->watcher.fd = -1;
|
inetd->watcher.fd = -1;
|
||||||
}
|
}
|
||||||
@@ -626,12 +628,10 @@ int inetd_new(inetd_t *inetd, char *name, char *service, char *proto, int forkin
|
|||||||
|
|
||||||
int inetd_del(inetd_t *inetd)
|
int inetd_del(inetd_t *inetd)
|
||||||
{
|
{
|
||||||
inetd_filter_t *filter, *tmp;
|
inetd->svc->block = 0;
|
||||||
|
inetd_stop(inetd);
|
||||||
|
|
||||||
TAILQ_FOREACH_SAFE(filter, &inetd->filters, link, tmp)
|
return inetd_flush(inetd);
|
||||||
free(filter);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in new issue
Block a user