mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Remove global variable that makes dlopen unhappy
This isn't the best way to do this, but it is the easiest. There are some limitations that are going to need to be addressed at some point with reloads and when I (or someone else) work on that, then the API can be updated to handle passing the private config data that the calendar tech modules need in a better way as well. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@223016 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -536,11 +536,12 @@ static int verify_cert(void *userdata, int failures, const ne_ssl_certificate *c
|
||||
static void *caldav_load_calendar(void *void_data)
|
||||
{
|
||||
struct caldav_pvt *pvt;
|
||||
const struct ast_config *cfg;
|
||||
struct ast_variable *v;
|
||||
struct ast_calendar *cal = void_data;
|
||||
ast_mutex_t refreshlock;
|
||||
|
||||
if (!(cal && ast_calendar_config)) {
|
||||
if (!(cal && (cfg = ast_calendar_config_acquire()))) {
|
||||
ast_log(LOG_ERROR, "You must enable calendar support for res_caldav to load\n");
|
||||
return NULL;
|
||||
}
|
||||
@@ -551,11 +552,13 @@ static void *caldav_load_calendar(void *void_data)
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Could not lock calendar, aborting!\n");
|
||||
}
|
||||
ast_calendar_config_release();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!(pvt = ao2_alloc(sizeof(*pvt), caldav_destructor))) {
|
||||
ast_log(LOG_ERROR, "Could not allocate caldav_pvt structure for calendar: %s\n", cal->name);
|
||||
ast_calendar_config_release();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -565,6 +568,7 @@ static void *caldav_load_calendar(void *void_data)
|
||||
ast_log(LOG_ERROR, "Could not allocate space for fetching events for calendar: %s\n", cal->name);
|
||||
pvt = unref_caldav(pvt);
|
||||
ao2_unlock(cal);
|
||||
ast_calendar_config_release();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -572,10 +576,11 @@ static void *caldav_load_calendar(void *void_data)
|
||||
ast_log(LOG_ERROR, "Couldn't allocate string field space for calendar: %s\n", cal->name);
|
||||
pvt = unref_caldav(pvt);
|
||||
ao2_unlock(cal);
|
||||
ast_calendar_config_release();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (v = ast_variable_browse(ast_calendar_config, cal->name); v; v = v->next) {
|
||||
for (v = ast_variable_browse(cfg, cal->name); v; v = v->next) {
|
||||
if (!strcasecmp(v->name, "url")) {
|
||||
ast_string_field_set(pvt, url, v->value);
|
||||
} else if (!strcasecmp(v->name, "user")) {
|
||||
@@ -585,6 +590,8 @@ static void *caldav_load_calendar(void *void_data)
|
||||
}
|
||||
}
|
||||
|
||||
ast_calendar_config_release();
|
||||
|
||||
if (ast_strlen_zero(pvt->url)) {
|
||||
ast_log(LOG_WARNING, "No URL was specified for CalDAV calendar '%s' - skipping.\n", cal->name);
|
||||
pvt = unref_caldav(pvt);
|
||||
|
Reference in New Issue
Block a user