File: 08-dictd-close-fds.patch

package info (click to toggle)
dictd 1.13.1%2Bdfsg-1.1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,940 kB
  • sloc: ansic: 12,523; sh: 4,435; yacc: 512; makefile: 442; cpp: 277; lex: 256; perl: 175; awk: 12
file content (25 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
From: Robert Luberda <robert@debian.org>
Date: Sun, 8 Mar 2009 23:44:31 +0100
Subject: 08 dictd close-fds

Close all file descriptors except for the standard ones not to hang
dpkg-reconfigure
---
 dictd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dictd.c b/dictd.c
index e91dcd9..fe27e42 100644
--- a/dictd.c
+++ b/dictd.c
@@ -1528,6 +1528,10 @@ int main (int argc, char **argv, char **envp)
       { 0,                  0, 0, 0  }
    };
 
+   /* close all file descriptors except for the standard ones */
+   for (i=getdtablesize()-1; i > 2; --i)
+     close(i);
+
    set_umask ();
    init (argv[0]);