diff --git a/io/io_fd.c b/io/io_fd.c index ab3005a..7cb3983 100644 --- a/io/io_fd.c +++ b/io/io_fd.c @@ -2,6 +2,7 @@ #define extern #include "io_internal.h" #undef extern +#include "byte.h" #ifdef HAVE_SIGIO #include #include @@ -23,9 +24,10 @@ int io_fd(int64 d) { long r; io_entry* e; - if ((r=fcntl(d,F_GETFL,0) & O_NDELAY) == -1) + if ((r=fcntl(d,F_GETFL,0)) == -1) return 0; /* file descriptor not open */ if (!(e=array_allocate(&io_fds,sizeof(io_entry),d))) return 0; + byte_zero(e,sizeof(io_entry)); e->inuse=1; if (r&O_NDELAY) e->nonblock=1; e->next_read=e->next_write=-1; diff --git a/io/io_waituntil2.c b/io/io_waituntil2.c index cab3469..b3a06f0 100644 --- a/io/io_waituntil2.c +++ b/io/io_waituntil2.c @@ -37,6 +37,8 @@ int64 io_waituntil2(int64 milliseconds) { e->next_write=first_writeable; first_writeable=y[i].data.fd; } + } else { + epoll_ctl(io_master,EPOLL_CTL_DEL,y[i].data.fd,y+i); } } return n;