From 2d7e6c5e2d292b1f4cc48e0b8de88c03483d0ff6 Mon Sep 17 00:00:00 2001 From: "trystan trystan@31f1291d-b8d6-0310-a050-a5561fc1590b" Date: Sun, 21 Nov 2004 01:31:23 +0000 Subject: [PATCH] BUILD : 1.7.6 (456) BUGS : N/A NOTES : Disables UseRDB if SQL fails to init git-svn-id: svn://svn.anope.org/anope/trunk@456 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@310 5417fbe8-f217-4b02-8779-1006273d7864 --- Changes | 1 + src/init.c | 5 ++++- src/mysql.c | 16 ++++++++++------ version.log | 6 +++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Changes b/Changes index cac780bb3..ba8a90fc6 100644 --- a/Changes +++ b/Changes @@ -7,6 +7,7 @@ Provided by Anope Dev. - 2004 Provided by Trystan - 2004 11/19 A Added anope_cmd_ctcp() to code API, for sending CTCP messages. [ #00] +11/20 F Disables UseRDB if there is an error duing SQL init [ #00] 11/20 F MS CHECK now checks if the nick is forbidden. [#225] 11/20 F Removing Sqline on bot nicks change if the nick was registered. [#224] 11/19 F normalizeBuffer() now strips control character 1. [ #00] diff --git a/src/init.c b/src/init.c index 899b79ee3..7a7113591 100644 --- a/src/init.c +++ b/src/init.c @@ -553,7 +553,10 @@ int init(int ac, char **av) helpserv_init(); #ifdef USE_RDB - rdb_init(); + if (!rdb_init()) { + UseRDB = 0; + alog("Error: Disabling UseRDB due to errors with SQL"); + } #endif /* Initialize proxy detection */ diff --git a/src/mysql.c b/src/mysql.c index e9827e7fb..707515113 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -54,11 +54,12 @@ int db_mysql_init() /* If the host is not defined, assume we don't want MySQL */ if (!MysqlHost) { do_mysql = 0; - alog("MySQL has been disabled."); + alog("MySQL: has been disabled."); + return 0; } else { do_mysql = 1; - alog("MySQL has been enabled."); - alog("MySQL client version %s.",mysql_get_client_info()); + alog("MySQL: has been enabled."); + alog("MySQL: client version %s.",mysql_get_client_info()); } /* The following configuration options are required. @@ -68,10 +69,13 @@ int db_mysql_init() if ((do_mysql) && (!MysqlName || !MysqlUser)) { do_mysql = 0; alog("MySQL Error: Set all required configuration options."); + return 0; } - if (!db_mysql_open()) + if (!db_mysql_open()) { do_mysql = 0; + return 0; + } return 1; } @@ -95,14 +99,14 @@ int db_mysql_open() if ((!mysql_real_connect (mysql, MysqlHost, MysqlUser, MysqlPass, MysqlName, MysqlPort, MysqlSock, 0))) { - log_perror("Cant connect to MySQL: %s\n", mysql_error(mysql)); + log_perror("MySQL Error: Cant connect to MySQL: %s\n", mysql_error(mysql)); return 0; } } else { if ((!mysql_real_connect (mysql, MysqlHost, MysqlUser, MysqlPass, MysqlName, MysqlPort, NULL, 0))) { - log_perror("Cant connect to MySQL: %s\n", mysql_error(mysql)); + log_perror("MySQL Error: Cant connect to MySQL: %s\n", mysql_error(mysql)); return 0; } } diff --git a/version.log b/version.log index cbdfbbe60..66fbb0e02 100644 --- a/version.log +++ b/version.log @@ -8,10 +8,14 @@ VERSION_MAJOR="1" VERSION_MINOR="7" VERSION_PATCH="6" -VERSION_BUILD="455" +VERSION_BUILD="456" # $Log$ # +# BUILD : 1.7.6 (456) +# BUGS : N/A +# NOTES : Disables UseRDB if SQL fails to init +# # BUILD : 1.7.6 (455) # BUGS : N/A # NOTES : Clean up changelog