From 757f70de67ebae6a6a5f27105151974567df0d1c Mon Sep 17 00:00:00 2001 From: "geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Fri, 9 Sep 2005 21:20:16 +0000 Subject: BUILD : 1.7.10 (877) BUGS : NOTES : Added two more globops warnings when a database cannott be opened git-svn-id: svn://svn.anope.org/anope/trunk@877 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@624 5417fbe8-f217-4b02-8779-1006273d7864 --- src/datafiles.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/datafiles.c b/src/datafiles.c index 5ccbe95ee..117f2c32e 100644 --- a/src/datafiles.c +++ b/src/datafiles.c @@ -17,6 +17,7 @@ #include static int curday = 0; +static time_t lastwarn = 0; /*************************************************************************/ @@ -91,6 +92,12 @@ static dbFILE *open_db_read(const char *service, const char *filename) if (!f) { #ifndef NOT_MAIN log_perror("Can't read %s database %s", service, filename); + if (time(NULL) - lastwarn > WarningTimeout) { + anope_cmd_global(NULL, + "Write error on %s: Memory allocation failed", + filename); + lastwarn = time(NULL); + } #endif return NULL; } @@ -103,6 +110,11 @@ static dbFILE *open_db_read(const char *service, const char *filename) if (errno != ENOENT) log_perror("Can not read %s database %s", service, f->filename); + if (time(NULL) - lastwarn > WarningTimeout) { + anope_cmd_global(NULL, "Write error on %s: %s", f->filename, + strerror(errno)); + lastwarn = time(NULL); + } #endif free(f); errno = errno_save; -- cgit