]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: fd: Properly init the fd state in fd_insert()
authorChristopher Faulet <cfaulet@haproxy.com>
Tue, 19 Jul 2022 10:04:18 +0000 (12:04 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 19 Jul 2022 10:11:04 +0000 (12:11 +0200)
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

index d95dcc82b51202e1df53924b490ab416ed20c43b..b57076beff8f8e9609f1e21ef44bb4be8fffcb2d 100644 (file)
@@ -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);