[Asterisk-cvs] asterisk manager.c,1.112,1.113
markster
markster
Sun Sep 25 13:01:56 CDT 2005
Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv13302
Modified Files:
manager.c
Log Message:
Fix manager EINTR issue (bug #5247)
Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- manager.c 25 Sep 2005 03:49:22 -0000 1.112
+++ manager.c 25 Sep 2005 16:58:56 -0000 1.113
@@ -1311,17 +1311,22 @@
}
fds[0].fd = s->fd;
fds[0].events = POLLIN;
- res = poll(fds, 1, -1);
- if (res < 0) {
- ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
- return -1;
- } else if (res > 0) {
- ast_mutex_lock(&s->lock);
- res = read(s->fd, s->inbuf + s->inlen, sizeof(s->inbuf) - 1 - s->inlen);
- ast_mutex_unlock(&s->lock);
- if (res < 1)
- return -1;
- }
+ do {
+ res = poll(fds, 1, -1);
+ if (res < 0) {
+ if (errno == EINTR)
+ continue;
+ ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
+ return -1;
+ } else if (res > 0) {
+ ast_mutex_lock(&s->lock);
+ res = read(s->fd, s->inbuf + s->inlen, sizeof(s->inbuf) - 1 - s->inlen);
+ ast_mutex_unlock(&s->lock);
+ if (res < 1)
+ return -1;
+ break;
+ }
+ } while(1);
s->inlen += res;
s->inbuf[s->inlen] = '\0';
return 0;
More information about the svn-commits
mailing list