fix(tools): register the inotify fd through tokio's unsafe constructor

tokio 1.54 deprecates AsyncFd::with_interest as unsound (RUSTSEC-2026-0386)
and Linux clippy flagged it. register_with_interest states the contract
the OwnedFd already keeps: the fd stays open and the same while the
AsyncFd owns it.
This commit is contained in:
雷电芽衣 committed 2026-10-31 02:52:21 -04:00
1 parent 2c9164b7fb
commit 8f8f637c81
1 file changed
+2 -1
@@ -106,7 +106,8 @@ mod linux {
// SAFETY: `raw` comes from a successful `inotify_init1`, so it is a
// live fd that nothing else owns.
let owned = unsafe { OwnedFd::from_raw_fd(raw) };
let fd = AsyncFd::with_interest(owned, Interest::READABLE)?;
// SAFETY: the AsyncFd owns `owned`, so the fd stays open and fixed.
let fd = unsafe { AsyncFd::register_with_interest(owned, Interest::READABLE) }?;
Ok(Inotify { fd })
}