Skip to content

Commit

Permalink
Fix ioctl() call error on freebsd/dragonfly
Browse files Browse the repository at this point in the history
This is a temporary fix to:
rust-lang/libc#704
  • Loading branch information
gchers committed Sep 5, 2017
1 parent 731725f commit 28ed48a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/unix/terminal.rs
Expand Up @@ -395,7 +395,10 @@ struct Winsize {
fn get_winsize(fd: c_int) -> io::Result<Winsize> {
let mut winsz: Winsize = unsafe { zeroed() };

let res = unsafe { ioctl(fd, TIOCGWINSZ, &mut winsz) };
// NOTE: this ".into()" is added as a temporary fix to a libc
// bug described in:
// https://github.com/rust-lang/libc/pull/704
let res = unsafe { ioctl(fd, TIOCGWINSZ.into(), &mut winsz) };

if res == -1 {
Err(io::Error::last_os_error())
Expand Down

0 comments on commit 28ed48a

Please sign in to comment.