[asterisk-commits] crichter: branch 1.2 r47359 - in /branches/1.2/channels: ./ misdn/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Nov 9 06:09:10 MST 2006


Author: crichter
Date: Thu Nov  9 07:09:10 2006
New Revision: 47359

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47359
Log:
Fixed segfault when no misdn.conf exists, reported by Igor Neves, thanks.

Modified:
    branches/1.2/channels/chan_misdn.c
    branches/1.2/channels/misdn/chan_misdn_config.h
    branches/1.2/channels/misdn_config.c

Modified: branches/1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_misdn.c?view=diff&rev=47359&r1=47358&r2=47359
==============================================================================
--- branches/1.2/channels/chan_misdn.c (original)
+++ branches/1.2/channels/chan_misdn.c Thu Nov  9 07:09:10 2006
@@ -4121,8 +4121,11 @@
 		return 0;
 	}
 	
-	
-	misdn_cfg_init(max_ports);
+	if (misdn_cfg_init(max_ports)<0) {
+		ast_log(LOG_ERROR, "Unable to initialize mISDN Config System\n");
+		return 0;
+	}
+
 	g_config_initialized=1;
 	
 	misdn_debug = (int *)malloc(sizeof(int) * (max_ports+1));

Modified: branches/1.2/channels/misdn/chan_misdn_config.h
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn/chan_misdn_config.h?view=diff&rev=47359&r1=47358&r2=47359
==============================================================================
--- branches/1.2/channels/misdn/chan_misdn_config.h (original)
+++ branches/1.2/channels/misdn/chan_misdn_config.h Thu Nov  9 07:09:10 2006
@@ -85,7 +85,7 @@
 };
 
 /* you must call misdn_cfg_init before any other function of this header file */
-void misdn_cfg_init(int max_ports); 
+int misdn_cfg_init(int max_ports); 
 void misdn_cfg_reload(void);
 void misdn_cfg_destroy(void);
 

Modified: branches/1.2/channels/misdn_config.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/misdn_config.c?view=diff&rev=47359&r1=47358&r2=47359
==============================================================================
--- branches/1.2/channels/misdn_config.c (original)
+++ branches/1.2/channels/misdn_config.c Thu Nov  9 07:09:10 2006
@@ -727,7 +727,7 @@
 	ast_mutex_destroy(&config_mutex);
 }
 
-void misdn_cfg_init (int this_max_ports)
+int misdn_cfg_init (int this_max_ports)
 {
 	char config[] = "misdn.conf";
 	char *cat, *p;
@@ -737,7 +737,7 @@
 
 	if (!(cfg = AST_LOAD_CFG(config))) {
 		ast_log(LOG_WARNING,"no misdn.conf ?\n");
-		return;
+		return -1;
 	}
 
 	misdn_cfg_lock();
@@ -783,4 +783,6 @@
 
 	misdn_cfg_unlock();
 	AST_DESTROY_CFG(cfg);
-}
+
+	return 0;
+}



More information about the asterisk-commits mailing list