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.
This commit is contained in:
Christopher Faulet 2022-07-19 12:04:18 +02:00
parent f7ebe584d7
commit 7e94b40a22

View 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].owner = owner;
fdtab[fd].iocb = iocb; fdtab[fd].iocb = iocb;
fdtab[fd].state = 0; fdtab[fd].state = newstate;
fdtab[fd].thread_mask = thread_mask; fdtab[fd].thread_mask = thread_mask;
fd_drop_tgid(fd); fd_drop_tgid(fd);