summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/knownhosts.rs2
-rw-r--r--src/session.rs4
3 files changed, 4 insertions, 4 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 1117684..498774f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ssh2"
-version = "0.1.1"
+version = "0.1.2"
authors = ["Alex Crichton <alex@alexcrichton.com>"]
license = "MIT/Apache-2.0"
keywords = ["ssh"]
diff --git a/src/knownhosts.rs b/src/knownhosts.rs
index 52ee3b1..6fec25e 100644
--- a/src/knownhosts.rs
+++ b/src/knownhosts.rs
@@ -260,7 +260,7 @@ impl<'kh> Host<'kh> {
pub fn name(&self) -> Option<&str> {
unsafe {
::opt_bytes(self, (*self.raw).name as *const _)
- .and_then(str::from_utf8)
+ .and_then(|s| str::from_utf8(s).ok())
}
}
diff --git a/src/session.rs b/src/session.rs
index c22d8e6..7d983cb 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -47,7 +47,7 @@ impl Session {
///
/// May return `None` on invalid utf-8 or if an error has ocurred.
pub fn banner(&self) -> Option<&str> {
- self.banner_bytes().and_then(str::from_utf8)
+ self.banner_bytes().and_then(|s| str::from_utf8(s).ok())
}
/// See `banner`.
@@ -209,7 +209,7 @@ impl Session {
unsafe {
let ptr = raw::libssh2_session_methods(self.raw,
method_type as c_int);
- ::opt_bytes(self, ptr).and_then(str::from_utf8)
+ ::opt_bytes(self, ptr).and_then(|s| str::from_utf8(s).ok())
}
}