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:
1 file changed
+2
-1
@@ -106,7 +106,8 @@ mod linux {
|
|||||||
// SAFETY: `raw` comes from a successful `inotify_init1`, so it is a
|
// SAFETY: `raw` comes from a successful `inotify_init1`, so it is a
|
||||||
// live fd that nothing else owns.
|
// live fd that nothing else owns.
|
||||||
let owned = unsafe { OwnedFd::from_raw_fd(raw) };
|
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 })
|
Ok(Inotify { fd })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user