xinetd/SOURCES/xinetd-2.3.14-leaking-fds-2a.patch
2021-10-08 17:42:08 +00:00

42 lines
1.1 KiB
Diff

diff -Naur xinetd-2.3.14-dist/xinetd/service.c xinetd-2.3.14/xinetd/service.c
--- xinetd-2.3.14-dist/xinetd/service.c 2012-04-03 08:59:19.000000000 +0200
+++ xinetd-2.3.14/xinetd/service.c 2012-04-03 09:02:34.588160317 +0200
@@ -366,12 +366,24 @@
msg( LOG_ERR, func,
"socket creation failed (%m). service = %s", SC_ID( scp ) ) ;
+#ifdef HAVE_POLL
+ SVC_EVENTS( sp ) = 0;
+ SVC_FD( sp ) = 0;
+#else
+ FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
+#endif /* HAVE_POLL */
return( FAILED ) ;
}
if ( set_fd_modes( sp ) == FAILED )
{
(void) Sclose( SVC_FD(sp) ) ;
+#ifdef HAVE_POLL
+ SVC_EVENTS( sp ) = 0;
+ SVC_FD( sp ) = 0;
+#else
+ FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
+#endif /* HAVE_POLL */
return( FAILED ) ;
}
@@ -385,6 +397,12 @@
if ( status == FAILED )
{
(void) Sclose( SVC_FD(sp) ) ;
+#ifdef HAVE_POLL
+ SVC_EVENTS( sp ) = 0;
+ SVC_FD( sp ) = 0;
+#else
+ FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
+#endif /* HAVE_POLL */
return( FAILED ) ;
}