Package not found: openSUSE:Slowroll:Build:1/kernel-source-longterm

File xinetd-2.3.14-restore-nofile-limits.patch of Package xinetd.5694

Index: xinetd-2.3.14/xinetd/child.c
===================================================================
--- xinetd-2.3.14.orig/xinetd/child.c
+++ xinetd-2.3.14/xinetd/child.c
@@ -205,6 +205,24 @@ static void set_credentials( const struc
    const char *func = "set_credentials" ;
 
    if ( SC_SPECIFIED( scp, A_GROUP ) || SC_SPECIFIED( scp, A_USER ) ) {
+#ifdef RLIMIT_NOFILE
+       /*
+        * init.c/set_fd_limit changes hard limit for nofile to FD_SETSIZE to
+        * prevent fd_set overflow. This must be restored before setgid/setuid,
+        * because non-root process will be limited to FD_SETSIZE and not
+        * properly inherited
+        *
+        * value of rlim_cur is not important as subsequent code in exec_server
+        * will use proper values
+        *
+        * https://bugzilla.novell.com/show_bug.cgi?id=855685
+        */
+       struct rlimit rl ;
+       rl.rlim_max = ps.ros.orig_max_descriptors ;
+       rl.rlim_cur = ps.ros.max_descriptors ;
+       (void) setrlimit( RLIMIT_NOFILE, &rl ) ;
+#endif
+
       if ( ps.ros.is_superuser )
       {
          gid_t gid = SC_GETGID( scp ) ;
openSUSE Build Service is sponsored by