Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Sat, 16 Dec 2000 02:28:11 +0000 (02:28 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Sat, 16 Dec 2000 02:28:11 +0000 (02:28 +0000)
Log message:

Fixed some bugs in debug logging code...

git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/trunk@342 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/ircd_log.c

index b89e437cb26b81364b796aa7abdccc1e2782c4fc..7236e77e4f3029ea7b3fe7283a0e43a505fc9d01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2000-12-15  Kevin L. Mitchell  <klmitch@mit.edu>
 
+       * ircd/ircd_log.c: found and fixed some bugs in the debug logging
+       code that would sometimes result in the log file not being
+       reopened--which meant that a user could connect and get the
+       logging output--oops
+
        * ircd/Makefile.in: run make depend...
 
        * ircd/s_stats.c: get rid of report_feature_list()
index ccd184397e28f1057a36e11722bb157fbf7557ab..d40c7f1dae22fa41a38bc26f09aa4c379ba41691 100644 (file)
@@ -207,8 +207,10 @@ log_debug_reopen(void)
   }
 
   /* Ok, it's a real file; close it if necessary and use log_open to open it */
-  if (logInfo.dbfile->fd >= 0)
+  if (logInfo.dbfile->fd >= 0) {
     close(logInfo.dbfile->fd);
+    logInfo.dbfile->fd = -1; /* mark that it's closed for log_open */
+  }
 
   log_open(logInfo.dbfile);
 
@@ -219,9 +221,10 @@ log_debug_reopen(void)
 
   /* massage the file descriptor to be stderr */
   if (logInfo.dbfile->fd != 2) {
-    dup2(logInfo.dbfile->fd, 2);
+    int fd;
+    fd = dup2(logInfo.dbfile->fd, 2);
     close(logInfo.dbfile->fd);
-    logInfo.dbfile->fd = 2;
+    logInfo.dbfile->fd = fd;
   }
 }
 
@@ -835,9 +838,7 @@ log_feature_mark(int flag)
 
   for (i = 0; i < LS_LAST_SYSTEM; i++) {
     if (!(logDesc[i].mark & LOG_MARK_FILE)) {
-      if (logDesc[i].subsys == LS_DEBUG)
-       log_debug_file(0); /* debug is special */
-      else {
+      if (logDesc[i].subsys != LS_DEBUG) { /* debug is special */
        if (logDesc[i].file) /* destroy previous entry... */
          log_file_destroy(logDesc[i].file);
        logDesc[i].file = 0;