about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/libstd/fs.rs10
-rw-r--r--src/libstd/sys/redox/fs.rs6
2 files changed, 2 insertions, 14 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index 0cb9a49ad67..e91e808c548 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -383,16 +383,6 @@ impl File {
     pub fn set_permissions(&self, perm: Permissions) -> io::Result<()> {
         self.inner.set_permissions(perm.0)
     }
-
-    /// Get the path that this file points to.
-    ///
-    /// This function is only implemented on Redox, but could be
-    /// implemented on other operating systems using readlink
-    #[cfg(target_os = "redox")]
-    #[unstable(feature = "file_path", issue="0")]
-    pub fn path(&self) -> io::Result<PathBuf> {
-        self.inner.path()
-    }
 }
 
 impl AsInner<fs_imp::File> for File {
diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs
index 80aec2e978d..9d5d2f5d921 100644
--- a/src/libstd/sys/redox/fs.rs
+++ b/src/libstd/sys/redox/fs.rs
@@ -319,10 +319,8 @@ impl File {
 
     pub fn path(&self) -> io::Result<PathBuf> {
         let mut buf: [u8; 4096] = [0; 4096];
-        match syscall::fpath(*self.fd().as_inner() as usize, &mut buf) {
-            Ok(count) => Ok(PathBuf::from(unsafe { String::from_utf8_unchecked(Vec::from(&buf[0..count])) })),
-            Err(err) => Err(Error::from_raw_os_error(err.errno)),
-        }
+        let count = cvt(syscall::fpath(*self.fd().as_inner() as usize, &mut buf))?;
+        Ok(PathBuf::from(unsafe { String::from_utf8_unchecked(Vec::from(&buf[..count])) }))
     }
 
     pub fn fd(&self) -> &FileDesc { &self.0 }