From 5cd4cb01f869d7575b1d76dce4f94671c772f8b2 Mon Sep 17 00:00:00 2001 From: codemastr Date: Fri, 24 Aug 2001 20:44:33 +0000 Subject: [PATCH] Fixed a log::maxsize bug where it would screw up when the file didn't exist --- Changes | 1 + src/s_extra.c | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Changes b/Changes index 8bc7b288a..8e93da732 100644 --- a/Changes +++ b/Changes @@ -824,3 +824,4 @@ seen. gmtime warning still there - Fixed something that could cause a possible bug in /oper ? - log::maxsize can now be entered in the format 1MB, 1MegaByte, 1MByte, etc (KB,MB,GB,TB are the only sizes recognized) +- Fixed a bug where log::maxsize would say it started a new log file if the log file didn't exist diff --git a/src/s_extra.c b/src/s_extra.c index fa079cfc6..8529d6736 100644 --- a/src/s_extra.c +++ b/src/s_extra.c @@ -433,8 +433,7 @@ void ircd_log(int flags, char *format, ...) sprintf(timebuf, "[%s] - ", myctime(TStime())); for (logs = conf_log; logs; logs = (ConfigItem_log *) logs->next) { if (logs->flags & flags) { - stat(logs->file, &fstats); - if (logs->maxsize && fstats.st_size >= logs->maxsize) { + if (stat(logs->file, &fstats) != -1 && logs->maxsize && fstats.st_size >= logs->maxsize) { #ifndef _WIN32 fd = open(logs->file, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IWUSR); #else