[asterisk-commits] mnicholson: branch 1.6.2 r311140 - /branches/1.6.2/main/manager.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 17 09:58:56 CDT 2011


Author: mnicholson
Date: Thu Mar 17 09:58:52 2011
New Revision: 311140

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311140
Log:
Don't write items to the manager socket twice.

AST-2011-003

Modified:
    branches/1.6.2/main/manager.c

Modified: branches/1.6.2/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/manager.c?view=diff&rev=311140&r1=311139&r2=311140
==============================================================================
--- branches/1.6.2/main/manager.c (original)
+++ branches/1.6.2/main/manager.c Thu Mar 17 09:58:52 2011
@@ -966,10 +966,10 @@
 static int send_string(struct mansession *s, char *string)
 {
 	int res;
-
-	if (s->f && (res = ast_careful_fwrite(s->f, s->fd, string, strlen(string), s->session->writetimeout))) {
-		s->write_error = 1;
-	} else if ((res = ast_careful_fwrite(s->session->f, s->session->fd, string, strlen(string), s->session->writetimeout))) {
+	FILE *f = s->f ? s->f : s->session->f;
+	int fd = s->f ? s->fd : s->session->fd;
+
+	if ((res = ast_careful_fwrite(f, fd, string, strlen(string), s->session->writetimeout))) {
 		s->write_error = 1;
 	}
 




More information about the asterisk-commits mailing list