From ddb12b1fe6a3a3f67818a4eca6ac45d35b3b46a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 2 Nov 1997 00:05:29 +0100
Subject: [PATCH] Now closes all other fds than stdin, stdout and stderr at
 start.

Rev: src/main.c:1.25
---
 src/main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main.c b/src/main.c
index 8ab42f1c19..fcf08190de 100644
--- a/src/main.c
+++ b/src/main.c
@@ -4,7 +4,7 @@
 ||| See the files COPYING and DISCLAIMER for more information.
 \*/
 #include "global.h"
-RCSID("$Id: main.c,v 1.24 1997/10/27 09:59:22 hubbe Exp $");
+RCSID("$Id: main.c,v 1.25 1997/11/01 23:05:29 grubba Exp $");
 #include "backend.h"
 #include "module.h"
 #include "object.h"
@@ -63,6 +63,13 @@ void main(int argc, char **argv, char **env)
 
   ARGV=argv;
 
+  /* Close extra fds (if any) */
+  for (e=3; e < MAX_OPEN_FILEDESCRIPTORS; e++) {
+    do {
+      num = close(e);
+    } while ((num < 0) && (errno == EINTR));
+  }
+
 #ifdef HAVE_SETLOCALE
 #ifdef LC_NUMERIC
   setlocale(LC_NUMERIC, "C");
-- 
GitLab