aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-03 13:24:35 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2008-09-03 13:24:35 +0000
commit1aed0a2895c42cdf3d71d2dd3f7427d91159c629 (patch)
treef4675f010f7ab7ff33eaa5ee2e9c4837318da0d2
parent1c5c3d5869cd0fe5e18d259dc959348ffee5a93a (diff)
Don't freak out if the poll emulation receives NULL for the pollfds array
(closes issue #13307) Reported by: jcovert git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@140816 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--main/poll.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/main/poll.c b/main/poll.c
index bd283866d..c053ba015 100644
--- a/main/poll.c
+++ b/main/poll.c
@@ -273,19 +273,19 @@ int poll
fd_set except_descs; /* exception descs */
struct timeval stime; /* select() timeout value */
int ready_descriptors; /* function result */
- int max_fd; /* maximum fd value */
+ int max_fd = 0; /* maximum fd value */
struct timeval *pTimeout; /* actually passed */
FD_ZERO (&read_descs);
FD_ZERO (&write_descs);
FD_ZERO (&except_descs);
- assert (pArray != (struct pollfd *) NULL);
-
/* Map the poll() file descriptor list in the select() data structures. */
- max_fd = map_poll_spec (pArray, n_fds,
- &read_descs, &write_descs, &except_descs);
+ if (pArray) {
+ max_fd = map_poll_spec (pArray, n_fds,
+ &read_descs, &write_descs, &except_descs);
+ }
/* Map the poll() timeout value in the select() timeout structure. */