From 6aa0809ced1af61934e5ec94fff2474c0ef8b6b4 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Sat, 16 Dec 2000 02:28:11 +0000 Subject: [PATCH] Author: Kev 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 | 5 +++++ ircd/ircd_log.c | 13 +++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index b89e437..7236e77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2000-12-15 Kevin L. Mitchell + * 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() diff --git a/ircd/ircd_log.c b/ircd/ircd_log.c index ccd1843..d40c7f1 100644 --- a/ircd/ircd_log.c +++ b/ircd/ircd_log.c @@ -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; -- 2.20.1