diff options
author | Charlie Ozinga <ozchaz@gmail.com> | 2016-03-23 14:50:26 -0600 |
---|---|---|
committer | Charlie Ozinga <ozchaz@gmail.com> | 2016-03-23 14:50:26 -0600 |
commit | 7b3de69d3621666d133e00135285354f325d0765 (patch) | |
tree | cf95033cbc910e99af5b478a255ac68a93a82d90 /src/session.rs | |
parent | c5cddaed1ca65c1c0b3d68e5f57177152079ba1c (diff) | |
download | ssh2-rs-7b3de69d3621666d133e00135285354f325d0765.zip |
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.
Diffstat (limited to 'src/session.rs')
-rw-r--r-- | src/session.rs | 2 |
1 files changed, 1 insertions, 1 deletions
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) { |