aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-21 16:20:18 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2010-07-21 16:20:18 +0000
commit7de0c0b692f7714dd375ddc1d7110568c7e4bc7e (patch)
tree6db366dfb35ca5770cd61bc573e3869b1460081a
parentc7f237bab2d33cc057540a48f68a6105109e3887 (diff)
Merged revisions 278465 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r278465 | russell | 2010-07-21 11:15:00 -0500 (Wed, 21 Jul 2010) | 41 lines Use poll() instead of select() in res_timing_pthread to avoid stack corruption. This code did not properly check FD_SETSIZE to ensure that it did not try to select() on fds that were too large. Switching to poll() removes the limitation on the maximum fd value. (closes issue #15915) Reported by: keiron (closes issue #17187) Reported by: Eddie Edwards (closes issue #16494) Reported by: Hubguru (closes issue #15731) Reported by: flop (closes issue #12917) Reported by: falves11 (closes issue #14920) Reported by: vrban (closes issue #17199) Reported by: aleksey2000 (closes issue #15406) Reported by: kowalma (closes issue #17438) Reported by: dcabot (closes issue #17325) Reported by: glwgoes (closes issue #17118) Reported by: erikje possibly other issues, too ... ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.2@278479 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--res/res_timing_pthread.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c
index 53ceeb5de..f6be63882 100644
--- a/res/res_timing_pthread.c
+++ b/res/res_timing_pthread.c
@@ -36,6 +36,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$");
#include "asterisk/astobj2.h"
#include "asterisk/time.h"
#include "asterisk/lock.h"
+#include "asterisk/poll-compat.h"
static void *timing_funcs_handle;
@@ -376,16 +377,12 @@ static void read_pipe(struct pthread_timer *timer, unsigned int quantity)
do {
unsigned char buf[1024];
ssize_t res;
- fd_set rfds;
- struct timeval timeout = {
- .tv_sec = 0,
+ struct pollfd pfd = {
+ .fd = rd_fd,
+ .events = POLLIN,
};
- /* Make sure there is data to read */
- FD_ZERO(&rfds);
- FD_SET(rd_fd, &rfds);
-
- if (select(rd_fd + 1, &rfds, NULL, NULL, &timeout) != 1) {
+ if (ast_poll(&pfd, 1, 0) != 1) {
ast_debug(1, "Reading not available on timing pipe, "
"quantity: %u\n", quantity);
break;