Use safe nix API instead of libc (#12315)

# Description
Where possible, this PR replaces usages of raw `libc` bindings to
instead use safe interfaces from the `nix` crate. Where not possible,
the `libc` version reexported through `nix` was used instead of having a
separate `libc` dependency.
This commit is contained in:
Ian Manske
2024-03-30 13:49:54 +00:00
committed by GitHub
parent 714a0ccd24
commit 251599c507
8 changed files with 103 additions and 128 deletions

View File

@ -120,7 +120,7 @@ mod foreground_pgroup {
/// Currently only intended to access `tcsetpgrp` and `tcgetpgrp` with the I/O safe `nix`
/// interface.
pub unsafe fn stdin_fd() -> impl AsFd {
unsafe { BorrowedFd::borrow_raw(libc::STDIN_FILENO) }
unsafe { BorrowedFd::borrow_raw(nix::libc::STDIN_FILENO) }
}
pub fn prepare_command(external_command: &mut Command, existing_pgrp: u32) {