Fix canonicalize

This commit is contained in:
Jeremy Soller 2016-11-25 19:53:21 -07:00
parent 3a1bb2ba26
commit d73d32f58d

View 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()
}