aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-31 22:12:23 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2005-08-31 22:12:23 +0000
commit5978fd4ed958fb751f9141248bf833971826b0d0 (patch)
treeeb1dbb8e8c2704698402a6336b322013e2329772
parenta19e58fdd5264b1c1d828a46e508a685ad1d4a63 (diff)
ensure revents fields are initialized before calling poll()
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@6476 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xasterisk.c2
-rwxr-xr-xchannel.c2
-rwxr-xr-xchannels/chan_zap.c4
-rwxr-xr-xio.c1
4 files changed, 9 insertions, 0 deletions
diff --git a/asterisk.c b/asterisk.c
index d50499dcf..d6a41b506 100755
--- a/asterisk.c
+++ b/asterisk.c
@@ -436,8 +436,10 @@ static void *netconsole(void *vconsole)
for(;;) {
fds[0].fd = con->fd;
fds[0].events = POLLIN;
+ fds[0].revents = 0;
fds[1].fd = con->p[0];
fds[1].events = POLLIN;
+ fds[1].revents = 0;
res = poll(fds, 2, -1);
if (res < 0) {
diff --git a/channel.c b/channel.c
index 338a568c9..7f94cde5b 100755
--- a/channel.c
+++ b/channel.c
@@ -1246,6 +1246,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (c[x]->fds[y] > -1) {
pfds[max].fd = c[x]->fds[y];
pfds[max].events = POLLIN | POLLPRI;
+ pfds[max].revents = 0;
max++;
}
}
@@ -1255,6 +1256,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
if (fds[x] > -1) {
pfds[max].fd = fds[x];
pfds[max].events = POLLIN | POLLPRI;
+ pfds[max].revents = 0;
max++;
}
}
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index c741cb6c5..45c75977e 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -2645,6 +2645,7 @@ int x;
size = READ_SIZE;
fds[0].fd = fd;
fds[0].events = POLLPRI | POLLOUT;
+ fds[0].revents = 0;
res = poll(fds, 1, -1);
if (!res) {
ast_log(LOG_DEBUG, "poll (for write) ret. 0 on channel %d\n", p->channel);
@@ -6271,6 +6272,7 @@ static void *do_monitor(void *data)
/* This needs to be watched, as it lacks an owner */
pfds[count].fd = i->subs[SUB_REAL].zfd;
pfds[count].events = POLLPRI;
+ pfds[count].revents = 0;
/* Message waiting or r2 channels also get watched for reading */
#ifdef ZAPATA_R2
if (i->cidspill || i->r2)
@@ -7831,6 +7833,7 @@ static void *pri_dchannel(void *vpri)
break;
fds[i].fd = pri->fds[i];
fds[i].events = POLLIN | POLLPRI;
+ fds[i].revents = 0;
}
numdchans = i;
time(&t);
@@ -10785,6 +10788,7 @@ static int zt_sendtext(struct ast_channel *c, const char *text)
size = READ_SIZE;
fds[0].fd = fd;
fds[0].events = POLLOUT | POLLPRI;
+ fds[0].revents = 0;
res = poll(fds, 1, -1);
if (!res) {
ast_log(LOG_DEBUG, "poll (for write) ret. 0 on channel %d\n", p->channel);
diff --git a/io.c b/io.c
index 9fd4e6d8a..9c9581114 100755
--- a/io.c
+++ b/io.c
@@ -165,6 +165,7 @@ int *ast_io_add(struct io_context *ioc, int fd, ast_io_cb callback, short events
*/
ioc->fds[ioc->fdcnt].fd = fd;
ioc->fds[ioc->fdcnt].events = events;
+ ioc->fds[ioc->fdcnt].revents = 0;
ioc->ior[ioc->fdcnt].callback = callback;
ioc->ior[ioc->fdcnt].data = data;
ioc->ior[ioc->fdcnt].id = (int *)malloc(sizeof(int));