about summary refs log tree commit diff
path: root/src/libstd/sys/unix/fs2.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstd/sys/unix/fs2.rs')
-rw-r--r--src/libstd/sys/unix/fs2.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libstd/sys/unix/fs2.rs b/src/libstd/sys/unix/fs2.rs
index 202e5ddaec4..c5d3dce2634 100644
--- a/src/libstd/sys/unix/fs2.rs
+++ b/src/libstd/sys/unix/fs2.rs
@@ -276,8 +276,14 @@ impl File {
 }
 
 fn cstr(path: &Path) -> io::Result<CString> {
-    let cstring = try!(path.as_os_str().to_cstring());
-    Ok(cstring)
+    path.as_os_str().to_cstring().ok_or(
+        io::Error::new(io::ErrorKind::InvalidInput, "path contained a null", None))
+}
+
+impl FromInner<c_int> for File {
+    fn from_inner(fd: c_int) -> File {
+        File(FileDesc::new(fd))
+    }
 }
 
 pub fn mkdir(p: &Path) -> io::Result<()> {