From 7b3de69d3621666d133e00135285354f325d0765 Mon Sep 17 00:00:00 2001 From: Charlie Ozinga Date: Wed, 23 Mar 2016 14:50:26 -0600 Subject: Allow all non-negative return codes as Ok() All libssh2 functions that return a failure do so using a negative value. However, some functions (for example: https://www.libssh2.org/libssh2_channel_read_ex.html) might return a positive value for success. We should recognize these positive values as Ok() instead of Err(). This is consistent with what Stream<'channel, 'sess>::read and ::write seem to expect in src/channel.rc. --- src/session.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/session.rs b/src/session.rs index d7f3aaa..e3566d1 100644 --- a/src/session.rs +++ b/src/session.rs @@ -604,7 +604,7 @@ impl Session { /// Translate a return code into a Rust-`Result`. pub fn rc(&self, rc: c_int) -> Result<(), Error> { - if rc == 0 { + if rc >= 0 { Ok(()) } else { match Error::last_error(self) { -- cgit v1.2.3