summaryrefslogtreecommitdiff
path: root/src/session.rs
diff options
context:
space:
mode:
authorCharlie Ozinga <ozchaz@gmail.com>2016-03-23 14:50:26 -0600
committerCharlie Ozinga <ozchaz@gmail.com>2016-03-23 14:50:26 -0600
commit7b3de69d3621666d133e00135285354f325d0765 (patch)
treecf95033cbc910e99af5b478a255ac68a93a82d90 /src/session.rs
parentc5cddaed1ca65c1c0b3d68e5f57177152079ba1c (diff)
downloadssh2-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.rs2
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) {