mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-14 16:33:34 +00:00
correct portability problem (don't look inside regex_t)
correct enable/disable option name to match sample config file git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@5453 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
9
dnsmgr.c
9
dnsmgr.c
@@ -55,6 +55,7 @@ static int refresh_interval;
|
|||||||
struct refresh_info {
|
struct refresh_info {
|
||||||
struct entry_list *entries;
|
struct entry_list *entries;
|
||||||
int verbose;
|
int verbose;
|
||||||
|
unsigned int regex_present:1;
|
||||||
regex_t filter;
|
regex_t filter;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -157,7 +158,7 @@ static int refresh_list(void *data)
|
|||||||
ast_verbose(VERBOSE_PREFIX_2 "Refreshing DNS lookups.\n");
|
ast_verbose(VERBOSE_PREFIX_2 "Refreshing DNS lookups.\n");
|
||||||
AST_LIST_LOCK(info->entries);
|
AST_LIST_LOCK(info->entries);
|
||||||
AST_LIST_TRAVERSE(info->entries, entry, list) {
|
AST_LIST_TRAVERSE(info->entries, entry, list) {
|
||||||
if (info->filter.used && regexec(&info->filter, entry->name, 0, NULL, 0))
|
if (info->regex_present && regexec(&info->filter, entry->name, 0, NULL, 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (info->verbose && (option_verbose > 2))
|
if (info->verbose && (option_verbose > 2))
|
||||||
@@ -200,11 +201,13 @@ static int handle_cli_refresh(int fd, int argc, char *argv[])
|
|||||||
if (argc == 3) {
|
if (argc == 3) {
|
||||||
if (regcomp(&info.filter, argv[2], REG_EXTENDED | REG_NOSUB))
|
if (regcomp(&info.filter, argv[2], REG_EXTENDED | REG_NOSUB))
|
||||||
return RESULT_SHOWUSAGE;
|
return RESULT_SHOWUSAGE;
|
||||||
|
else
|
||||||
|
info.regex_present = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
refresh_list(&info);
|
refresh_list(&info);
|
||||||
|
|
||||||
if (info.filter.used)
|
if (info.regex_present)
|
||||||
regfree(&info.filter);
|
regfree(&info.filter);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -297,7 +300,7 @@ static int do_reload(int loading)
|
|||||||
ast_sched_del(sched, refresh_sched);
|
ast_sched_del(sched, refresh_sched);
|
||||||
|
|
||||||
if ((config = ast_config_load("dnsmgr.conf"))) {
|
if ((config = ast_config_load("dnsmgr.conf"))) {
|
||||||
if ((enabled_value = ast_variable_retrieve(config, "general", "enabled"))) {
|
if ((enabled_value = ast_variable_retrieve(config, "general", "enable"))) {
|
||||||
enabled = ast_true(enabled_value);
|
enabled = ast_true(enabled_value);
|
||||||
}
|
}
|
||||||
if ((interval_value = ast_variable_retrieve(config, "general", "refreshinterval"))) {
|
if ((interval_value = ast_variable_retrieve(config, "general", "refreshinterval"))) {
|
||||||
|
Reference in New Issue
Block a user