aboutsummaryrefslogtreecommitdiffstats
path: root/manager.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-25 16:58:56 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2005-09-25 16:58:56 +0000
commitbbfcc37178c6d5ba1b6f2237d3015aa1fd7ce20b (patch)
treee77e59f75d077c4ad1bbfad947269b9986dca09a /manager.c
parentdb4f0e234eef678459207170e407d3dee45f27ea (diff)
Fix manager EINTR issue (bug #5247)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6644 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'manager.c')
-rwxr-xr-xmanager.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/manager.c b/manager.c
index 568c23f64..99571b19c 100755
--- a/manager.c
+++ b/manager.c
@@ -1311,17 +1311,22 @@ static int get_input(struct mansession *s, char *output)
}
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;