aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_oss.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-21 22:21:40 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2006-09-21 22:21:40 +0000
commitdc031e8e3c92f6b34fe59ca2601c714a4fddca22 (patch)
tree48c539d8533f828c2237a87e5564a6f184e8950e /channels/chan_oss.c
parent66d265719952e22290d4093567f43b9adcb1e5aa (diff)
Some more clean up in the load function for chan_oss (issue #8002 reported by Mithraen with minor mods by moi)
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@43456 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_oss.c')
-rw-r--r--channels/chan_oss.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/channels/chan_oss.c b/channels/chan_oss.c
index 876e247dc..e29b9086a 100644
--- a/channels/chan_oss.c
+++ b/channels/chan_oss.c
@@ -1836,39 +1836,39 @@ static struct chan_oss_pvt *store_config(struct ast_config *cfg, char *ctg)
static int load_module(void)
{
- int i;
- struct ast_config *cfg;
+ struct ast_config *cfg = NULL;
+ char *ctg = NULL;
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
/* load config file */
- cfg = ast_config_load(config);
- if (cfg != NULL) {
- char *ctg = NULL; /* first pass is 'general' */
-
- do {
- store_config(cfg, ctg);
- } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
- ast_config_destroy(cfg);
- } else {
- ast_log(LOG_NOTICE, "Unable to load config oss.conf\n");
- return AST_MODULE_LOAD_DECLINE;
+ if (!(cfg = ast_config_load(config))) {
+ ast_log(LOG_NOTICE, "Unable to load config %s\n", config);
+ return AST_MODULE_LOAD_DECLINE;
}
+
+ do {
+ store_config(cfg, ctg);
+ } while ( (ctg = ast_category_browse(cfg, ctg)) != NULL);
+
+ ast_config_destroy(cfg);
+
if (find_desc(oss_active) == NULL) {
ast_log(LOG_NOTICE, "Device %s not found\n", oss_active);
/* XXX we could default to 'dsp' perhaps ? */
/* XXX should cleanup allocated memory etc. */
- return -1;
+ return AST_MODULE_LOAD_FAILURE;
}
- i = ast_channel_register(&oss_tech);
- if (i < 0) {
- ast_log(LOG_ERROR, "Unable to register channel class 'Console'\n");
- /* XXX should cleanup allocated memory etc. */
- return -1;
+
+ if (ast_channel_register(&oss_tech)) {
+ ast_log(LOG_ERROR, "Unable to register channel class 'MGCP'\n");
+ return AST_MODULE_LOAD_FAILURE;
}
+
ast_cli_register_multiple(cli_oss, sizeof(cli_oss) / sizeof(struct ast_cli_entry));
- return 0;
+
+ return AST_MODULE_LOAD_SUCCESS;
}