diff --git a/Cargo.lock b/Cargo.lock index e61ad9f..757d7c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,16 +1,3 @@ -[root] -name = "redox-ssh" -version = "0.1.0" -dependencies = [ - "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", - "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "num-bigint 0.1.39 (git+https://github.com/rust-num/num)", - "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "byteorder" version = "1.1.0" @@ -72,6 +59,19 @@ dependencies = [ "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "redox-ssh" +version = "0.1.0" +dependencies = [ + "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.39 (git+https://github.com/rust-num/num)", + "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "rust-crypto 0.2.36 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "redox_syscall" version = "0.1.26" diff --git a/src/channel.rs b/src/channel.rs index 73139bb..9f18393 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -86,10 +86,17 @@ impl Channel { ); self.read_thread = Some(thread::spawn(move || { + #[cfg(target_os = "redox")] + use syscall::dup; + #[cfg(target_os = "redox")] + let master2 = unsafe { dup(master_fd, &[]).unwrap_or(!0) }; + + #[cfg(not(target_os = "redox"))] use libc::dup; + #[cfg(not(target_os = "redox"))] let master2 = unsafe { dup(master_fd) }; - println!("dup result: {}", dup as u32); + println!("dup result: {}", master2 as u32); let mut master = unsafe { File::from_raw_fd(master2) }; loop { use std::str::from_utf8_unchecked;