]> git.lizzy.rs Git - rust.git/commitdiff
Fix canonicalize
authorJeremy Soller <jackpot51@gmail.com>
Sat, 26 Nov 2016 02:53:21 +0000 (19:53 -0700)
committerJeremy Soller <jackpot51@gmail.com>
Sat, 26 Nov 2016 02:53:21 +0000 (19:53 -0700)
src/libstd/sys/redox/fs.rs

index 0e51da711c98d97426c1fa9379f1f1aaed39b8a5..12aa17becd8609e159978daf6f09598a037f732e 100644 (file)
@@ -452,9 +452,8 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
 }
 
 pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
-    let mut options = OpenOptions::new();
-    options.read(true);
-    let file = File::open(p, &options)?;
+    let fd = cvt(open(p.to_str().unwrap(), libc::O_CLOEXEC | libc::O_STAT))?;
+    let file = File(FileDesc::new(fd));
     file.path()
 }