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

01101d
diff -up xinetd-2.3.14-dist/xinetd/service.c xinetd-2.3.14/xinetd/service.c
01101d
--- xinetd-2.3.14-dist/xinetd/service.c	2012-01-11 11:50:43.438650900 +0100
01101d
+++ xinetd-2.3.14/xinetd/service.c	2012-01-16 08:18:09.462620084 +0100
01101d
@@ -88,6 +88,7 @@ struct service *svc_new( struct service_
01101d
    CLEAR( *sp ) ;
01101d
 
01101d
    SVC_CONF(sp) = scp ;
01101d
+   sp->svc_pfd_index = -1;
01101d
    return( sp ) ;
01101d
 }
01101d
 
01101d
@@ -346,7 +347,16 @@ status_e svc_activate( struct service *s
01101d
        ps.rws.pfds_last)*sizeof(struct pollfd));
01101d
      ps.rws.pfd_array = tmp;
01101d
    }
01101d
-   SVC_POLLFD( sp ) = &ps.rws.pfd_array[ps.rws.pfds_last++] ;
01101d
+   if ( sp->svc_pfd_index >= 0 )
01101d
+   {
01101d
+     SVC_POLLFD( sp ) = &ps.rws.pfd_array[sp->svc_pfd_index] ;
01101d
+   }
01101d
+   else
01101d
+   {
01101d
+     sp->svc_pfd_index = ps.rws.pfds_last ;
01101d
+     SVC_POLLFD( sp ) = &ps.rws.pfd_array[ps.rws.pfds_last++] ;
01101d
+   }
01101d
+
01101d
 #endif /* HAVE_POLL */
01101d
 
01101d
    if( SC_IPV4( scp ) ) {
01101d
@@ -433,6 +443,11 @@ status_e svc_activate( struct service *s
01101d
 static void deactivate( const struct service *sp )
01101d
 {
01101d
    (void) Sclose( SVC_FD( sp ) ) ;
01101d
+#ifdef HAVE_POLL
01101d
+   SVC_FD( sp ) = 0;
01101d
+#else      
01101d
+   FD_CLR( SVC_FD( sp ), &ps.rws.socket_mask ) ;
01101d
+#endif
01101d
 
01101d
 #ifdef HAVE_MDNS
01101d
    xinetd_mdns_deregister(SVC_CONF(sp));
01101d
diff -up xinetd-2.3.14-dist/xinetd/service.h xinetd-2.3.14/xinetd/service.h
01101d
--- xinetd-2.3.14-dist/xinetd/service.h	2012-01-11 11:50:43.418650925 +0100
01101d
+++ xinetd-2.3.14/xinetd/service.h	2012-01-16 08:02:59.667553008 +0100
01101d
@@ -47,6 +47,7 @@ struct service
01101d
 {
01101d
    state_e                svc_state ;
01101d
    int                    svc_ref_count ;   /* # of pters to this struct */
01101d
+   int                    svc_pfd_index;    /* index of pfd in pfd_array */
01101d
    struct service_config *svc_conf ;    /* service configuration */
01101d
 
01101d
 #ifdef HAVE_POLL