Committer  : klmitch
CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Commit time: 2005-05-11 04:29:51 UTC

Modified files:
     ChangeLog ircd/ircd.c

Log message:

Author: Kev <[EMAIL PROTECTED]>
Log message:

Fix server restart loop problem when debugging is enabled.

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.630 ircu2.10/ChangeLog:1.631
--- ircu2.10/ChangeLog:1.630    Tue May 10 21:15:01 2005
+++ ircu2.10/ChangeLog  Tue May 10 21:29:41 2005
@@ -1,3 +1,12 @@
+2005-05-11  Kevin L. Mitchell  <[EMAIL PROTECTED]>
+
+       * ircd/ircd.c: if debugging is enabled (both DEBUGMODE defined and
+       -x given), reserve fd 2 for the use of the debugging log;
+       otherwise, some engines may attempt to use fd 2, which would end
+       up getting closed by debug_init() (actually, by
+       log_debug_reopen(), called by log_debug_init(), called by
+       debug_init())
+
 2005-08-10  Michael Poole <[EMAIL PROTECTED]>
 
        * ircd/channel.c (joinbuf_join): Do not send a MODE +o when a
Index: ircu2.10/ircd/ircd.c
diff -u ircu2.10/ircd/ircd.c:1.87 ircu2.10/ircd/ircd.c:1.88
--- ircu2.10/ircd/ircd.c:1.87   Sun Apr 24 20:35:54 2005
+++ ircu2.10/ircd/ircd.c        Tue May 10 21:29:41 2005
@@ -19,7 +19,7 @@
  */
 /** @file
  * @brief Entry point and other initialization functions for the daemon.
- * @version $Id: ircd.c,v 1.87 2005/04/25 03:35:54 entrope Exp $
+ * @version $Id: ircd.c,v 1.88 2005/05/11 04:29:41 klmitch Exp $
  */
 #include "config.h"
 
@@ -656,6 +656,23 @@
    */
   daemon_init(thisServer.bootopt & BOOT_TTY);
 
+#ifdef DEBUGMODE
+  /* Must reserve fd 2... */
+  if (debuglevel >= 0 && !(thisServer.bootopt & BOOT_TTY)) {
+    int fd;
+    if ((fd = open("/dev/null", O_WRONLY)) < 0) {
+      fprintf(stderr, "Unable to open /dev/null (to reserve fd 2): %s\n",
+             strerror(errno));
+      return 8;
+    }
+    if (fd != 2 && dup2(fd, 2) < 0) {
+      fprintf(stderr, "Unable to reserve fd 2; dup2 said: %s\n",
+             strerror(errno));
+      return 8;
+    }
+  }
+#endif
+
   event_init(MAXCONNECTIONS);
 
   setup_signals();
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches

Reply via email to