Fix TIOCGWINSZ type mismatch on DragonFly
Below is the error message I got before this patch: error[E0308]: mismatched types --> src/sys/unix/size.rs:17:34 | 17 | cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut size as *mut _))?; | ^^^^^^^^^^ expected u64, found u32 help: you can cast an `u32` to `u64`, which will zero-extend the source value | 17 | cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?; | ^^^^^^^^^^^^^^^^^
This commit is contained in:
parent
ce6b43d071
commit
0837ad5ab1
|
@ -14,7 +14,7 @@ struct TermSize {
|
|||
pub fn terminal_size() -> io::Result<(u16, u16)> {
|
||||
unsafe {
|
||||
let mut size: TermSize = mem::zeroed();
|
||||
cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut size as *mut _))?;
|
||||
cvt(ioctl(STDOUT_FILENO, TIOCGWINSZ.into(), &mut size as *mut _))?;
|
||||
Ok((size.col as u16, size.row as u16))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue