Change read_blocked parameter type to RawFd for clarity

This commit is contained in:
Xiretza 2023-04-16 17:56:19 +00:00 committed by Johannes Altmanninger
parent 14fc11b5b8
commit ed3fdaa665

View file

@ -1433,7 +1433,7 @@ fn can_be_encoded(wc: char) -> bool {
/// Call read, blocking and repeating on EINTR. Exits on EAGAIN.
/// \return the number of bytes read, or 0 on EOF. On EAGAIN, returns -1 if nothing was read.
pub fn read_blocked(fd: i32, mut buf: &mut [u8]) -> isize {
pub fn read_blocked(fd: RawFd, mut buf: &mut [u8]) -> isize {
loop {
let res = unsafe { libc::read(fd, std::ptr::addr_of_mut!(buf).cast(), buf.len()) };
if res < 0 && errno::errno().0 == EINTR {