diff options
Diffstat (limited to 'source3/lib')
-rw-r--r-- | source3/lib/events.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/source3/lib/events.c b/source3/lib/events.c index d987072884..7670eb1f10 100644 --- a/source3/lib/events.c +++ b/source3/lib/events.c @@ -68,7 +68,7 @@ bool event_add_to_select_args(struct tevent_context *ev, } bool run_events(struct tevent_context *ev, - int *selrtn, fd_set *read_fds, fd_set *write_fds) + int selrtn, fd_set *read_fds, fd_set *write_fds) { struct tevent_fd *fde; struct timeval now; @@ -113,7 +113,7 @@ bool run_events(struct tevent_context *ev, return true; } - if (*selrtn <= 0) { + if (selrtn == 0) { /* * No fd ready */ @@ -123,16 +123,8 @@ bool run_events(struct tevent_context *ev, for (fde = ev->fd_events; fde; fde = fde->next) { uint16 flags = 0; - if (FD_ISSET(fde->fd, read_fds)) { - flags |= EVENT_FD_READ; - FD_CLR(fde->fd, read_fds); - (*selrtn)--; - } - if (FD_ISSET(fde->fd, write_fds)) { - flags |= EVENT_FD_WRITE; - FD_CLR(fde->fd, write_fds); - (*selrtn)--; - } + if (FD_ISSET(fde->fd, read_fds)) flags |= EVENT_FD_READ; + if (FD_ISSET(fde->fd, write_fds)) flags |= EVENT_FD_WRITE; if (flags & fde->flags) { fde->handler(ev, fde, flags, fde->private_data); @@ -171,7 +163,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location) struct timeval to; fd_set r_fds, w_fds; int maxfd = 0; - int ret = 0; + int ret; FD_ZERO(&r_fds); FD_ZERO(&w_fds); @@ -179,7 +171,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location) to.tv_sec = 9999; /* Max timeout */ to.tv_usec = 0; - if (run_events(ev, &ret, NULL, NULL)) { + if (run_events(ev, 0, NULL, NULL)) { return 0; } @@ -196,7 +188,7 @@ static int s3_event_loop_once(struct tevent_context *ev, const char *location) return -1; } - run_events(ev, &ret, &r_fds, &w_fds); + run_events(ev, ret, &r_fds, &w_fds); return 0; } |