Ver Fonte

db_postgres: init DB API lib in mod_register()

- this will initialize the sql buffer at module load time, avoiding
  crash at startup if a module using the DB driver is loaded before the
  db driver itself
- reported by Timo Teras
(cherry picked from commit b3b34accb2f65ccef6045b083879166cb1a1e060)
Daniel-Constantin Mierla há 14 anos atrás
pai
commit
244cdf2a86
2 ficheiros alterados com 8 adições e 1 exclusões
  1. 1 1
      modules/db_postgres/km_db_postgres.c
  2. 7 0
      modules/db_postgres/pg_mod.c

+ 1 - 1
modules/db_postgres/km_db_postgres.c

@@ -73,7 +73,7 @@ struct kam_module_exports kam_exports = {
 
 int km_postgres_mod_init(void)
 {
-	return db_query_init();
+	return 0;
 }
 
 int db_postgres_bind_api(db_func_t *dbb)

+ 7 - 0
modules/db_postgres/pg_mod.c

@@ -530,6 +530,13 @@ int pg_test(void)
 }
 #endif /* PG_TEST */
 
+int mod_register(char *path, int *dlflags, void *p1, void *p2)
+{
+	if(db_query_init()<0)
+		return -1;
+	return 0;
+}
+
 static int pg_mod_init(void)
 {
 #ifdef PG_TEST