Module: sip-router Branch: janakj/postgres Commit: 62925779f2f900351e4e614d10725631d68741cf URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=62925779...
Author: Andrei Pelinescu-Onciul andrei@iptel.org Committer: Andrei Pelinescu-Onciul andrei@iptel.org Date: Thu Feb 22 00:24:16 2007 +0000
- 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 jan.andres@freenet-ag.de.
closes SER-227
---
modules/db_postgres/dbase.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/modules/db_postgres/dbase.c b/modules/db_postgres/dbase.c index 60ccc95..0305efa 100644 --- a/modules/db_postgres/dbase.c +++ b/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;