Parcourir la source

- 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 il y a 18 ans
Parent
commit
62925779f2
1 fichiers modifiés avec 6 ajouts et 0 suppressions
  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;