diff --git a/Changes b/Changes index 823ef4f1f..419b085e7 100644 --- a/Changes +++ b/Changes @@ -409,3 +409,5 @@ - Possible FD leak in ircd_log, caused by some codemastr coding(TM) - #define HELP_WHO for the "did a /who 0 o" - Added a new Win32 GUI does it work, no one knows +- Rewrote the ircd_log function a bit to fix the FD bug better, not sure wtf I was smoking + when I wrote the last one :P diff --git a/src/s_extra.c b/src/s_extra.c index abae2df7a..9dc836a5c 100644 --- a/src/s_extra.c +++ b/src/s_extra.c @@ -411,19 +411,14 @@ void ircd_log(int flags, char *format, ...) strcat(buf, "\n"); sprintf(timebuf, "[%s] - ", myctime(TStime())); for (logs = conf_log; logs; logs = (ConfigItem_log *) logs->next) { - fd = open(logs->file, O_CREAT|O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR); - if (fd == -1) - continue; if (logs->flags & flags) { + fd = open(logs->file, O_CREAT|O_APPEND|O_WRONLY, S_IRUSR|S_IWUSR); + if (fd == -1) + continue; write(fd, timebuf, strlen(timebuf)); write(fd, buf, strlen(buf)); close(fd); } - else - { - /* anti-codemastr(TM) coding */ - close(fd); - } } va_end(ap); }