Skip to content

Commit

Permalink
Fix prev commit - data may be null for valid fd maps (like timer jobs)
Browse files Browse the repository at this point in the history
(cherry picked from commit b90094c)
  • Loading branch information
bogdan-iancu committed Jul 3, 2017
1 parent 172a15f commit 8dd3d5a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions io_wait.h
Expand Up @@ -274,7 +274,7 @@ static inline int kq_ev_change(io_wait_h* h, int fd, int filter, int flag,
/* iterate the fd_array and check if fd_hash is properly set for each */ \
for(k=0;k<h->fd_no;k++) {\
_e = get_fd_map(h, h->fd_array[k].fd); \
if (_e->type==0 || _e->fd<0 || _e->data==NULL || \
if (_e->type==0 || _e->fd<0 || \
(_e->flags&(IO_WATCH_READ|IO_WATCH_WRITE))==0 ) {\
LM_BUG("fd_array idx %d (fd=%d) points to bogus map "\
"(fd=%d,type=%d,flags=%d,data=%p)\n",k,h->fd_array[k].fd,\
Expand All @@ -297,7 +297,7 @@ static inline int kq_ev_change(io_wait_h* h, int fd, int filter, int flag,
}\
} else {\
/* fd in used, check if in checked */ \
if (_e->fd<0 || _e->data==NULL || \
if (_e->fd<0 || \
(_e->flags&(IO_WATCH_READ|IO_WATCH_WRITE))==0 ) {\
LM_BUG("used fd map fd=%d has bogus data "\
"(fd=%d,type=%d,flags=%d,data=%p)\n",k,\
Expand Down
2 changes: 1 addition & 1 deletion io_wait_loop.h
Expand Up @@ -174,7 +174,7 @@ inline static int io_wait_loop_epoll(io_wait_h* h, int t, int repeat)
#endif
/* do some sanity check over the triggered fd */
e = ((struct fd_map*)h->ep_array[r].data.ptr);
if (e->type==0 || e->fd<0 || e->data==NULL || (e->flags&(IO_WATCH_READ|IO_WATCH_WRITE))==0 ) {
if (e->type==0 || e->fd<0 || (e->flags&(IO_WATCH_READ|IO_WATCH_WRITE))==0 ) {
LM_BUG("[%s] unset/bogus map triggered for %d by epoll "
"(fd=%d,type=%d,flags=%d,data=%p)\n",h->name,
h->ep_array[r].events,
Expand Down

0 comments on commit 8dd3d5a

Please sign in to comment.