mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-06 04:30:28 +00:00
clean up find_engine()
issue a warning when a config file mapping is found but the desired driver is not available (inspired by bug #4628) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6032 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
22
config.c
22
config.c
@@ -857,28 +857,26 @@ static struct ast_config_engine *find_engine(const char *filename, char *databas
|
|||||||
|
|
||||||
ast_mutex_lock(&config_lock);
|
ast_mutex_lock(&config_lock);
|
||||||
|
|
||||||
map = config_maps;
|
for (map = config_maps; map; map = map->next) {
|
||||||
while (map) {
|
|
||||||
if (!strcasecmp(filename, map->name)) {
|
if (!strcasecmp(filename, map->name)) {
|
||||||
strncpy(database, map->database, dbsiz-1);
|
ast_copy_string(database, map->database, dbsiz);
|
||||||
if (map->table)
|
ast_copy_string(table, map->table ? map->table : filename, tabsiz);
|
||||||
strncpy(table, map->table, tabsiz-1);
|
|
||||||
else
|
|
||||||
strncpy(table, filename, tabsiz-1);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
map = map->next;
|
|
||||||
}
|
}
|
||||||
if (map) {
|
if (map) {
|
||||||
for (eng = config_engine_list; eng; eng = eng->next) {
|
for (eng = config_engine_list; !ret && eng; eng = eng->next) {
|
||||||
if (!strcmp(eng->name, map->driver)) {
|
if (!strcasecmp(eng->name, map->driver))
|
||||||
ret = eng;
|
ret = eng;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ast_mutex_unlock(&config_lock);
|
ast_mutex_unlock(&config_lock);
|
||||||
|
|
||||||
|
/* if we found a mapping, but the engine is not available, then issue a warning */
|
||||||
|
if (map && !ret)
|
||||||
|
ast_log(LOG_WARNING, "Mapping for '%s' found to engine '%s', but the engine is not available\n", map->name, map->driver);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user