From 7e94b40a22fab080b072c4757d487a40d2c6f828 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Tue, 19 Jul 2022 12:04:18 +0200 Subject: [PATCH] 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. --- include/haproxy/fd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/haproxy/fd.h b/include/haproxy/fd.h index d95dcc82b..b57076bef 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);