Skip to content

Commit

Permalink
Fix for prev+1 commit - fd=0 should be consider unset (as -1)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0dfbad3)
  • Loading branch information
bogdan-iancu committed Jul 3, 2017
1 parent e05db18 commit 2035f40
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions io_wait.h
Expand Up @@ -278,7 +278,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 || \
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 @@ -293,15 +293,15 @@ static inline int kq_ev_change(io_wait_h* h, int fd, int filter, int flag,
_e = get_fd_map(h, k); \
if (_e->type==0) { \
/* fd not in used, everything should be on zero */ \
if (_e->fd>=0 || _e->data!=NULL || _e->flags!=0 ) {\
if (_e->fd>0 || _e->data!=NULL || _e->flags!=0 ) {\
LM_BUG("unused fd_map fd=%d has bogus data "\
"(fd=%d,flags=%d,data=%p)\n",k,\
_e->fd, _e->flags, _e->data);\
check_error = 1;\
}\
} else {\
/* fd in used, check if in checked */ \
if (_e->fd<0 || \
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 @@ -178,7 +178,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->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 2035f40

Please sign in to comment.