Skip to content

Commit

Permalink
posix: eventfd: Fix unsetting internal flags in ioctl
Browse files Browse the repository at this point in the history
Commit e6eb0a7 ("posix: eventfd: revise locking, signaling, and
allocation") introduced a regression where the internal flags of an
event file descriptor would be erased when calling the F_SETFL ioctl
operation.

This includes the flag EFD_IN_USE_INTERNAL which determines whether
this file descriptor has been opened, thus effectively closing the
eventfd whenever one tries to change a flag.

Signed-off-by: Celina Sophie Kalus <[email protected]>
(cherry picked from commit 5bd86ea)
  • Loading branch information
celinakalus authored and github-actions[bot] committed Apr 13, 2024
1 parent 0e0cd2a commit 31007df
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/posix/eventfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ static int eventfd_ioctl_op(void *obj, unsigned int request, va_list args)
errno = EINVAL;
ret = -1;
} else {
efd->flags = flags;
int prev_flags = efd->flags & ~EFD_FLAGS_SET_INTERNAL;

efd->flags = flags | prev_flags;
ret = 0;
}
} break;
Expand Down

0 comments on commit 31007df

Please sign in to comment.