Update nix to 0.30.1 (#11458)

After nix updated to 0.30, all functions related to file descriptor accepts impl AsFd, e.g., BorrowedFd. This PR is a minimal update. It tries to use impl AsFd as long as possible, but uses BorrowedFd in some places. Yes it introduces unsafe, but doesn't introduce new unsafe code.
This commit is contained in:
Yuyi Wang
2025-05-06 16:52:54 +08:00
committed by GitHub
parent 2f278f4bfa
commit c2eaef7273
8 changed files with 16 additions and 14 deletions

View File

@@ -32,6 +32,7 @@
use std::num::NonZeroUsize;
use std::ops::ControlFlow;
use std::ops::Range;
use std::os::fd::BorrowedFd;
use std::os::fd::RawFd;
use std::pin::Pin;
use std::rc::Rc;
@@ -797,7 +798,7 @@ fn read_ni(parser: &Parser, fd: RawFd, io: &IoChain) -> Result<(), ErrorCode> {
loop {
let mut buff = [0_u8; 4096];
match nix::unistd::read(fd, &mut buff) {
match nix::unistd::read(unsafe { BorrowedFd::borrow_raw(fd) }, &mut buff) {
Ok(0) => {
// EOF.
break;