Redox: Use O_NOFOLLOW for lstat()
This commit is contained in:
parent
9475ae477a
commit
51260f4a6d
@ -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> {
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user