[Asterisk-cvs] asterisk manager.c,1.126,1.127

markster markster
Fri Oct 14 16:43:09 CDT 2005


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

Modified Files:
	manager.c 
Log Message:
Fix carefulwrite and its usage within manager (bug #5355, maybe)


Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.126
retrieving revision 1.127
diff -u -d -r1.126 -r1.127
--- manager.c	13 Oct 2005 23:29:24 -0000	1.126
+++ manager.c	14 Oct 2005 20:37:40 -0000	1.127
@@ -118,12 +118,15 @@
 		if (res < 0) res = 0;
 		len -= res;
 		s += res;
-		fds[0].fd = fd;
-		fds[0].events = POLLOUT;
-		/* Wait until writable again */
-		res = poll(fds, 1, timeoutms);
-		if (res < 1)
-			return -1;
+		res = 0;
+		if (len) {
+			fds[0].fd = fd;
+			fds[0].events = POLLOUT;
+			/* Wait until writable again */
+			res = poll(fds, 1, timeoutms);
+			if (res < 1)
+				return -1;
+		}
 	}
 	return res;
 }
@@ -1292,7 +1295,7 @@
 		ast_mutex_lock(&s->__lock);
 		s->busy = 0;
 		while(s->eventq) {
-			if (ast_carefulwrite(s->fd, s->eventq->eventdata, strlen(s->eventq->eventdata), s->writetimeout)) {
+			if (ast_carefulwrite(s->fd, s->eventq->eventdata, strlen(s->eventq->eventdata), s->writetimeout) < 0) {
 				ret = -1;
 				break;
 			}




More information about the svn-commits mailing list