Hi,
bird needs something like this because in case it daemonizes it still
keeps the fds open of the controlling tty which is bad in case you'd
like to log out which then will hang.

I already opened a Debian Bug - See:

        http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=427772

Flo

diff -Nur bird-1.0.11/sysdep/unix/main.c bird-1.0.11.flo/sysdep/unix/main.c
--- bird-1.0.11/sysdep/unix/main.c      2007-06-20 09:13:21.000000000 +0200
+++ bird-1.0.11.flo/sysdep/unix/main.c  2007-06-20 09:21:00.000000000 +0200
@@ -434,7 +434,18 @@
        die("fork: %m");
       if (pid)
        return 0;
+
       setsid();
+
+      /* Close all FDs and thus detach from controlling tty */
+      for (i=getdtablesize();i>=0;--i)
+        close(i);
+
+      /* create harmless stdin/out/err */
+      i=open("/dev/null",O_RDWR);
+      dup(i);
+      dup(i);
+
     }
 
   signal_init();
-- 
Florian Lohoff                  [EMAIL PROTECTED]             +49-171-2280134
        Those who would give up a little freedom to get a little 
          security shall soon have neither - Benjamin Franklin

Attachment: signature.asc
Description: Digital signature

Reply via email to