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
2000-12-15 Kevin L. Mitchell <klmitch@mit.edu>
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()
* ircd/Makefile.in: run make depend...
* ircd/s_stats.c: get rid of report_feature_list()
}
/* Ok, it's a real file; close it if necessary and use log_open to open it */
}
/* 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);
close(logInfo.dbfile->fd);
+ logInfo.dbfile->fd = -1; /* mark that it's closed for log_open */
+ }
log_open(logInfo.dbfile);
log_open(logInfo.dbfile);
/* massage the file descriptor to be stderr */
if (logInfo.dbfile->fd != 2) {
/* 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);
close(logInfo.dbfile->fd);
- logInfo.dbfile->fd = 2;
+ logInfo.dbfile->fd = fd;
for (i = 0; i < LS_LAST_SYSTEM; i++) {
if (!(logDesc[i].mark & LOG_MARK_FILE)) {
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;
if (logDesc[i].file) /* destroy previous entry... */
log_file_destroy(logDesc[i].file);
logDesc[i].file = 0;