diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-29 20:20:04 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-09-29 20:20:04 +0000 |
commit | 075bcc2b60c4d53906c0dbd4da6aba73330f1646 (patch) | |
tree | a9d8f6316fe746efa0e31ef52e55a75267e43d59 /asterisk.c | |
parent | 977162929930e61ce11b75ce6c7c89a383170f3e (diff) |
Check with select before accept (bug #325)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1580 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'asterisk.c')
-rwxr-xr-x | asterisk.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c index 58fb6f3d0..ac7173f4f 100755 --- a/asterisk.c +++ b/asterisk.c @@ -216,6 +216,7 @@ static void *netconsole(void *vconsole) static void *listener(void *unused) { struct sockaddr_un sun; + fd_set fds; int s; int len; int x; @@ -226,6 +227,13 @@ static void *listener(void *unused) for(;;) { if (ast_socket < 0) return NULL; + FD_ZERO(&fds); + FD_SET(ast_socket, &fds); + s = ast_select(ast_socket + 1, &fds, NULL, NULL, NULL); + if (s < 0) { + ast_log(LOG_WARNING, "Select retured error: %s\n", strerror(errno)); + continue; + } len = sizeof(sun); s = accept(ast_socket, (struct sockaddr *)&sun, &len); if (s < 0) { |