Skip to content

epoll: use from_bits_retain to avoid panics on unknown flags#2783

Open
kamalmarhubi wants to merge 1 commit intonix-rust:masterfrom
kamalmarhubi:push-kvsnutkumzqs
Open

epoll: use from_bits_retain to avoid panics on unknown flags#2783
kamalmarhubi wants to merge 1 commit intonix-rust:masterfrom
kamalmarhubi:push-kvsnutkumzqs

Conversation

@kamalmarhubi
Copy link
Copy Markdown
Member

What does this PR do

EpollEvent::events() used from_bits().unwrap(), which panics if the kernel returns flags unknown to the current bitflags definition. Use from_bits_retain to preserve all bits without panicking.

Checklist:

  • I have read CONTRIBUTING.md
  • I have written necessary tests and rustdoc comments
  • A change log has been added if this PR modifies nix's API

EpollEvent::events() used from_bits().unwrap(), which panics if the
kernel returns flags unknown to the current bitflags definition. Use
from_bits_retain to preserve all bits without panicking.
@kamalmarhubi kamalmarhubi marked this pull request as ready for review April 25, 2026 02:24
@xtqqczze
Copy link
Copy Markdown
Contributor

from_bits_retain only became available with #2027, so it's less likely the original intent was to panic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants