Merged revisions 43456 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r43456 | file | 2006-09-21 18:21:40 -0400 (Thu, 21 Sep 2006) | 2 lines

Some more clean up in the load function for chan_oss (issue #8002 reported by Mithraen with minor mods by moi)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@43457 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.0
Joshua Colp 19 years ago
parent a5e4e31654
commit 794d34f90c

@ -1556,39 +1556,39 @@ static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg)
static int load_module(void) static int load_module(void)
{ {
int i; struct ast_config *cfg = NULL;
struct ast_config *cfg; char *ctg = NULL;
/* Copy the default jb config over global_jbconf */ /* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf)); memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
/* load config file */ /* load config file */
cfg = ast_config_load(config); if (!(cfg = ast_config_load(config))) {
if (cfg != NULL) { ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
char *ctg = NULL; /* first pass is 'general' */ return AST_MODULE_LOAD_DECLINE;
}
do { do {
store_config(cfg, ctg); store_config(cfg, ctg);
} while ( (ctg = ast_category_browse(cfg, ctg)) != NULL); } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
ast_config_destroy(cfg); ast_config_destroy(cfg);
} else {
ast_log(LOG_NOTICE, "Unable to load config oss.conf\n");
return AST_MODULE_LOAD_DECLINE;
}
if (find_desc(oss_active) == NULL) { if (find_desc(oss_active) == NULL) {
ast_log(LOG_NOTICE, "Device %s not found\n", oss_active); ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);
/* XXX we could default to 'dsp' perhaps ? */ /* XXX we could default to 'dsp' perhaps ? */
/* XXX should cleanup allocated memory etc. */ /* XXX should cleanup allocated memory etc. */
return -1; return AST_MODULE_LOAD_FAILURE;
} }
i = ast_channel_register(&oss_tech);
if (i < 0) { if (ast_channel_register(&oss_tech)) {
ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n"); ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
/* XXX should cleanup allocated memory etc. */ return AST_MODULE_LOAD_FAILURE;
return -1;
} }
ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry)); ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
return 0;
return AST_MODULE_LOAD_SUCCESS;
} }

Loading…
Cancel
Save