mirror of
https://github.com/samba-team/samba.git
synced 2025-02-03 13:47:25 +03:00
tevent: Fix maxfd calculation in tevent_select
When doing fd1 = tevent_add_fd(ev, ev, 2, 0, NULL, NULL); fd2 = tevent_add_fd(ev, ev, 3, 0, NULL, NULL); TALLOC_FREE(fd2); fd2 = tevent_add_fd(ev, ev, 1, 0, NULL, NULL); we end up with select_ev->maxfd==1. This is wrong. An alternative fix might be to make select_ev->maxfd an unsigned int and make EVENT_INVALID_MAXFD==UINT_MAX. But in theory we might end up with an fd of UINT_MAX. std_event_add_fd() contains exactly the same piece of code, so I'm directly pushing it. Volker
This commit is contained in:
parent
9fdb69ebcd
commit
7f29f817fa
@ -116,7 +116,8 @@ static struct tevent_fd *select_event_add_fd(struct tevent_context *ev, TALLOC_C
|
||||
handler_name, location);
|
||||
if (!fde) return NULL;
|
||||
|
||||
if (fde->fd > select_ev->maxfd) {
|
||||
if ((select_ev->maxfd != EVENT_INVALID_MAXFD)
|
||||
&& (fde->fd > select_ev->maxfd)) {
|
||||
select_ev->maxfd = fde->fd;
|
||||
}
|
||||
talloc_set_destructor(fde, select_event_fd_destructor);
|
||||
|
Loading…
x
Reference in New Issue
Block a user