Blame SOURCES/xinetd-2.3.14-leaking-fds-2a.patch

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