summaryrefslogtreecommitdiff
path: root/mail/exim/patches/patch-af
blob: c1bdb0dae6fe930e9692f8004e0f5eea282c422b (plain)
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
26
27
28
29
30
31
$NetBSD: patch-af,v 1.2 2004/05/07 17:47:32 abs Exp $

--- src/daemon.c.orig	Wed May  5 11:08:35 2004
+++ src/daemon.c
@@ -756,6 +756,7 @@ daemon_go(void)
 {
 int *listen_sockets = NULL;
 int listen_socket_count = 0;
+int fd;
 ip_address_item *addresses = NULL;
 
 /* If any debugging options are set, turn on the D_pid bit so that all
@@ -1082,9 +1083,17 @@ if (background_daemon)
   {
   log_close_all();  /* Just in case anything was logged earlier */
   search_tidyup();  /* Just in case any were used in reading the config. */
-  close(0);         /* Get rid of stdin/stdout/stderr */
+  /* Get rid of stdin/stdout/stderr 
+  close(0);
   close(1);
   close(2);
+  */
+  /* Instead of closing, dup them to /dev/null */
+  fd= open( "/dev/null", O_RDWR );
+  dup2( fd, 0 ); 
+  dup2( fd, 1 ); 
+  dup2( fd, 2 );
+  if( fd > 2 ) close( fd );
   log_stderr = NULL;  /* So no attempt to copy paniclog output */
 
   /* If the parent process of this one has pid == 1, we are re-initializing the