提交 cd71ea73 编写于 作者: B bors

Auto merge of #43056 - ids1024:nofollow2, r=burntsushi

Redox: Use O_NOFOLLOW for lstat()
......@@ -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_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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册