[asterisk-commits] mnicholson: branch 1.6.1 r311139 - /branches/1.6.1/main/manager.c

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


Author: mnicholson
Date: Thu Mar 17 09:57:49 2011
New Revision: 311139

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

AST-2011-003

Modified:
    branches/1.6.1/main/manager.c

Modified: branches/1.6.1/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.1/main/manager.c?view=diff&rev=311139&r1=311138&r2=311139
==============================================================================
--- branches/1.6.1/main/manager.c (original)
+++ branches/1.6.1/main/manager.c Thu Mar 17 09:57:49 2011
@@ -946,10 +946,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