[Asterisk-cvs] asterisk channel.c, 1.249, 1.250 devicestate.c, 1.7, 1.8

markster markster
Mon Oct 17 11:47:55 CDT 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv31029

Modified Files:
	channel.c devicestate.c 
Log Message:
Handle device state changes properly when formatting characters are present (bug #5450, new patch)


Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.249
retrieving revision 1.250
diff -u -d -r1.249 -r1.250
--- channel.c	16 Oct 2005 16:11:52 -0000	1.249
+++ channel.c	17 Oct 2005 15:41:55 -0000	1.250
@@ -939,7 +939,7 @@
 	free(chan);
 	ast_mutex_unlock(&chlock);
 
-	ast_device_state_changed(name);
+	ast_device_state_changed_literal(name);
 }
 
 static void ast_spy_detach(struct ast_channel *chan) 
@@ -2883,7 +2883,7 @@
 		return 0;
 
 	chan->_state = state;
-	ast_device_state_changed(chan->name);
+	ast_device_state_changed_literal(chan->name);
 	manager_event(EVENT_FLAG_CALL,
 		      (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
 		      "Channel: %s\r\n"

Index: devicestate.c
===================================================================
RCS file: /usr/cvsroot/asterisk/devicestate.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- devicestate.c	14 Sep 2005 20:46:49 -0000	1.7
+++ devicestate.c	17 Oct 2005 15:41:55 -0000	1.8
@@ -193,22 +193,14 @@
 	ast_hint_state_changed(device);
 }
 
-/*--- ast_device_state_changed: Accept change notification, add it to change queue */
-int ast_device_state_changed(const char *fmt, ...) 
+static int __ast_device_state_changed_literal(char *buf)
 {
-	char buf[AST_MAX_EXTENSION];
 	char *device;
 	char *parse;
 	struct state_change *change = NULL;
-	va_list ap;
-
-	va_start(ap, fmt);
-	vsnprintf(buf, sizeof(buf), fmt, ap);
-	va_end(ap);
 
 	parse = buf;
 	device = strsep(&parse, "-");
-
 	if (change_thread != AST_PTHREADT_NULL)
 		change = calloc(1, sizeof(*change) + strlen(device));
 
@@ -230,6 +222,25 @@
 	return 1;
 }
 
+int ast_device_state_changed_literal(const char *dev)
+{
+	char *buf;
+	buf = ast_strdupa(dev);
+	return __ast_device_state_changed_literal(buf);
+}
+
+/*--- ast_device_state_changed: Accept change notification, add it to change queue */
+int ast_device_state_changed(const char *fmt, ...) 
+{
+	char buf[AST_MAX_EXTENSION];
+	va_list ap;
+
+	va_start(ap, fmt);
+	vsnprintf(buf, sizeof(buf), fmt, ap);
+	va_end(ap);
+	return __ast_device_state_changed_literal(buf);
+}
+
 /*--- do_devstate_changes: Go through the dev state change queue and update changes in the dev state thread */
 static void *do_devstate_changes(void *data)
 {




More information about the svn-commits mailing list