summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/init.c5
-rw-r--r--src/mysql.c16
2 files changed, 14 insertions, 7 deletions
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;
}
}