Browse Source

- fix the yesterday's fix: allow db_init from main if it's done from mod_init
(but don't allow it and log a BUG if it happens from child_init(PROC_MAIN)).

(SER-227 related)

Andrei Pelinescu-Onciul 18 years ago
parent
commit
89143e1d58
1 changed files with 3 additions and 1 deletions
  1. 3 1
      modules/db_postgres/dbase.c

+ 3 - 1
modules/db_postgres/dbase.c

@@ -40,6 +40,7 @@
 #include "../../db/db_pool.h"
 #include "../../ut.h"
 #include "../../globals.h"
+#include "../../pt.h"
 #include "pg_con.h"
 #include "pg_type.h"
 #include "db_mod.h"
@@ -228,7 +229,8 @@ db_con_t* pg_init(const char* url)
 	id = 0;
 	res = 0;
 
-	if (is_main){
+	/* if called from PROC_MAIN, allow it only from mod_init( when pt==0)*/
+	if (is_main && pt){
 		LOG(L_ERR, "BUG: postgres: pg_init: called from the main process,"
 					" ignoring...\n");
 		return 0;