--- channels/chan_oss.c (svn) +++ channels/chan_oss.c (working copy) @@ -1507,37 +1507,38 @@ { int i; struct ast_config *cfg; + char *ctg = NULL; /* first pass is 'general' */ /* 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' */ + if (cfg == NULL) { + ast_log(LOG_NOTICE, "Unable to load config oss.conf\n"); + return AST_MODULE_LOAD_DECLINE; + } - 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; - } + 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; + return AST_MODULE_LOAD_FAILURE; } ast_cli_register_multiple(myclis, sizeof(myclis) / sizeof(struct ast_cli_entry)); - return 0; + return AST_MODULE_LOAD_SUCCESS; }