浏览代码

- fix: db connections should not be opened from child_init(PROC_MAIN),
or they will be inherited by all the tcp processes (bad). Bug reported by
Jan Andres <[email protected]>.

closes SER-227

Andrei Pelinescu-Onciul 18 年之前
父节点
当前提交
03f639684d
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      modules/db_mysql/dbase.c

+ 7 - 0
modules/db_mysql/dbase.c

@@ -36,6 +36,7 @@
 #include "../../mem/mem.h"
 #include "../../dprint.h"
 #include "../../db/db_pool.h"
+#include "../../globals.h"
 #include "utils.h"
 #include "val.h"
 #include "my_con.h"
@@ -255,6 +256,12 @@ db_con_t* db_init(const char* _url)
 	id = 0;
 	res = 0;
 
+	if (is_main){
+		LOG(L_ERR, "BUG: mysql: db_init: called from the main process,"
+					" ignoring...\n");
+		return 0;
+	}
+
 	if (!_url) {
 		LOG(L_ERR, "db_init: Invalid parameter value\n");
 		return 0;