]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Create a local alias for ast_odbc_clear_cache.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 1 Sep 2011 17:28:09 +0000 (17:28 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 1 Sep 2011 17:28:09 +0000 (17:28 +0000)
As a function pointer, the reference has to be resolved at load time
irrespective of the RTLD_LAZY flag.  Creating a local alias solves
this problem, because the structure is initialized with that local
function pointer, while the actual function can remain lazily linked
until runtime.

The reason why this is important is because we lazily load function
references during the module loading process, in order to obtain
priority values for each module, ensuring that modules are loaded in
the correct order.  Previous to this change, when this module was
initially loaded, the module loader would emit a symbol resolution
error, because of the above requirement.

Closes ASTERISK-18399 (reported by Mikael Carlsson, fix suggested by
Walter Doekes, patch by me)

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@334229 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_odbc.c

index fc2b8fa1b93b8b39f3842b716d9cb201ed030f70..7bd0889c4526447f6f3b2e2506fc822d5da04078 100644 (file)
@@ -1131,6 +1131,11 @@ static int require_odbc(const char *database, const char *table, va_list ap)
 #undef warn_length
 #undef warn_type
 
+static int unload_odbc(const char *a, const char *b)
+{
+       return ast_odbc_clear_cache(a, b);
+}
+
 static struct ast_config_engine odbc_engine = {
        .name = "odbc",
        .load_func = config_odbc,
@@ -1141,7 +1146,7 @@ static struct ast_config_engine odbc_engine = {
        .update_func = update_odbc,
        .update2_func = update2_odbc,
        .require_func = require_odbc,
-       .unload_func = ast_odbc_clear_cache,
+       .unload_func = unload_odbc,
 };
 
 static int unload_module (void)