From: Christopher Faulet Date: Tue, 19 Jul 2022 10:04:18 +0000 (+0200) Subject: BUG/MINOR: fd: Properly init the fd state in fd_insert() X-Git-Tag: v2.7-dev3~80 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7e94b40a22fab080b072c4757d487a40d2c6f828;p=thirdparty%2Fhaproxy.git BUG/MINOR: fd: Properly init the fd state in fd_insert() When a new fd is inserted in the fdtab array, its state is initialized. The "newstate" variable is used to compute the right state (0 by default, but FD_ET_POSSIBLE flag is set if edge-triggered is supported for the fd). However, this variable is never used and the fd state is always set to 0. Now, the fd state is initialized with "newstate" variable. This bug was introduced by commit ddedc1662 ("MEDIUM: fd: make fd_insert/fd_delete atomically update fd.tgid"). No backport needed. --- diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h index d95dcc82b5..b57076beff 100644 --- a/include/haproxy/fd.h +++ b/include/haproxy/fd.h @@ -446,7 +446,7 @@ static inline void fd_insert(int fd, void *owner, void (*iocb)(int fd), int tgid fdtab[fd].owner = owner; fdtab[fd].iocb = iocb; - fdtab[fd].state = 0; + fdtab[fd].state = newstate; fdtab[fd].thread_mask = thread_mask; fd_drop_tgid(fd);