File: limit-fd-handling.patch

package info (click to toggle)
uucp 1.07-31
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,180 kB
  • sloc: ansic: 53,821; sh: 4,477; makefile: 202; perl: 199
file content (23 lines) | stat: -rw-r--r-- 757 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: limit the number of FDs to close
 In case of huge ulimits, startup is slow as probably millions of
 FDs have to be closed. In this case we limit ourselves to 4k.
 -> #942859
Index: uucp/unix/init.c
===================================================================
--- uucp.orig/unix/init.c	2025-09-15 13:04:19.665364078 +0200
+++ uucp/unix/init.c	2025-09-15 19:35:19.561281306 +0200
@@ -182,6 +182,14 @@
 #endif /* ! HAVE_SYSCONF */
 #endif /* ! HAVE_GETDTABLESIZE */
 
+      /*
+       * we don't have to close everything as this might be
+       * really a lot nowadays.
+       * we limit ourselves to 4k
+       */
+      if (cdescs > 4096) {
+        cdescs=4096;
+      }
       for (o = 3; o < cdescs; o++)
 	(void) close (o);
     }