소스 검색

- 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 년 전
부모
커밋
62925779f2
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      modules/db_postgres/dbase.c

+ 6 - 0
modules/db_postgres/dbase.c

@@ -39,6 +39,7 @@
 #include "../../dprint.h"
 #include "../../db/db_pool.h"
 #include "../../ut.h"
+#include "../../globals.h"
 #include "pg_con.h"
 #include "pg_type.h"
 #include "db_mod.h"
@@ -227,6 +228,11 @@ db_con_t* pg_init(const char* url)
 	id = 0;
 	res = 0;
 
+	if (is_main){
+		LOG(L_ERR, "BUG: postgres: pg_init: called from the main process,"
+					" ignoring...\n");
+		return 0;
+	}
 	if (!url) {
 		ERR("Invalid parameter value\n");
 		return 0;