Redox: Use O_NOFOLLOW for lstat()

This commit is contained in:
Ian Douglas Scott 2017-07-03 19:21:03 -07:00
parent 9475ae477a
commit 51260f4a6d
No known key found for this signature in database
GPG Key ID: 4924E10E199B5959
2 changed files with 5 additions and 1 deletions

View File

@ -447,7 +447,10 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
}
pub fn lstat(p: &Path) -> io::Result<FileAttr> {
stat(p)
let fd = cvt(syscall::open(p.to_str().unwrap(),
syscall::O_CLOEXEC | syscall::O_STAT | syscall::O_NOFOLLOW))?;
let file = File(FileDesc::new(fd));
file.file_attr()
}
pub fn canonicalize(p: &Path) -> io::Result<PathBuf> {

View File

@ -55,6 +55,7 @@ pub const O_EXCL: usize = 0x0800_0000;
pub const O_DIRECTORY: usize = 0x1000_0000;
pub const O_STAT: usize = 0x2000_0000;
pub const O_SYMLINK: usize = 0x4000_0000;
pub const O_NOFOLLOW: usize = 0x8000_0000;
pub const O_ACCMODE: usize = O_RDONLY | O_WRONLY | O_RDWR;
pub const SEEK_SET: usize = 0;