+2005-05-11 Kevin L. Mitchell <klmitch@mit.edu>
+
+ * 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 <mdpoole@troilus.org>
* ircd/channel.c (joinbuf_join): Do not send a MODE +o when a
*/
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();