mirror of
https://github.com/troglobit/finit.git
synced 2026-10-27 12:20:54 +00:00
inetd: Fix possible tcp socket leaks, found by Coverity Scan
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
71026adf03
commit
91b3e5eeb4
1 file changed
+5
-2
+5
-2
@@ -155,13 +155,16 @@ static void socket_cb(uev_t *w, void *arg, int events)
|
|||||||
*/
|
*/
|
||||||
if (fcntl(stdin, F_SETFL, fcntl(stdin, F_GETFL, 0) & ~O_NONBLOCK) < 0) {
|
if (fcntl(stdin, F_SETFL, fcntl(stdin, F_GETFL, 0) & ~O_NONBLOCK) < 0) {
|
||||||
logit(LOG_CRIT, "Failed disabling non-blocking on %s socket", svc->cmd);
|
logit(LOG_CRIT, "Failed disabling non-blocking on %s socket", svc->cmd);
|
||||||
|
if (svc->inetd.type == SOCK_STREAM)
|
||||||
|
close(stdin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
task = svc_new(svc->cmd, svc->inetd.next_id++, SVC_TYPE_INETD_CONN);
|
task = svc_new(svc->cmd, svc->inetd.next_id++, SVC_TYPE_INETD_CONN);
|
||||||
if (!task) {
|
if (!task) {
|
||||||
logit(LOG_CRIT, "%s: Unable to allocate service for inetd client",
|
logit(LOG_CRIT, "%s: Unable to allocate service for inetd client", svc->cmd);
|
||||||
svc->cmd);
|
if (svc->inetd.type == SOCK_STREAM)
|
||||||
|
close(stdin);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user