From 3aa8096bc4e1c6c762f8553c516b5ce099ba5f71 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Mon, 29 Jul 2019 14:03:34 -0700 Subject: Fix scp_recv ABI issue on Windows * Adopt scp_recv2 instead, which uses compatible 64-bit stat types * Mark scp_recv as deprecated * small version bump Fixes https://github.com/alexcrichton/ssh2-rs/issues/109 Refs https://github.com/alexcrichton/ssh2-rs/pull/117 Co-authored-by: Joyce Babu --- src/session.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/session.rs b/src/session.rs index 3ae3473..bce81ad 100644 --- a/src/session.rs +++ b/src/session.rs @@ -533,8 +533,8 @@ impl Session { pub fn scp_recv(&self, path: &Path) -> Result<(Channel, ScpFileStat), Error> { let path = try!(CString::new(try!(util::path2bytes(path)))); unsafe { - let mut sb: libc::stat = mem::zeroed(); - let ret = raw::libssh2_scp_recv(self.inner.raw, path.as_ptr(), &mut sb); + let mut sb: raw::libssh2_struct_stat = mem::zeroed(); + let ret = raw::libssh2_scp_recv2(self.inner.raw, path.as_ptr(), &mut sb); let mut c = Channel::from_raw_opt(ret, &self.inner)?; // Hm, apparently when we scp_recv() a file the actual channel @@ -543,7 +543,7 @@ impl Session { // artificially limit the channel to a certain amount of bytes that // can be read. c.limit_read(sb.st_size as u64); - Ok((c, ScpFileStat { stat: sb })) + Ok((c, ScpFileStat { stat: *sb })) } } -- cgit v1.2.3