Skip to content

Commit d73d32f

Browse files
committed
Fix canonicalize
1 parent 3a1bb2b commit d73d32f

File tree

1 file changed

+2
-3
lines changed
  • src/libstd/sys/redox

1 file changed

+2
-3
lines changed

src/libstd/sys/redox/fs.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,8 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
452452
}
453453

454454
pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {
455-
let mut options = OpenOptions::new();
456-
options.read(true);
457-
let file = File::open(p, &options)?;
455+
let fd = cvt(open(p.to_str().unwrap(), libc::O_CLOEXEC | libc::O_STAT))?;
456+
let file = File(FileDesc::new(fd));
458457
file.path()
459458
}
460459

0 commit comments

Comments
 (0)