File tree Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Expand file tree Collapse file tree 2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -447,7 +447,10 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
447447}
448448
449449pub fn lstat ( p : & Path ) -> io:: Result < FileAttr > {
450- stat ( p)
450+ let fd = cvt ( syscall:: open ( p. to_str ( ) . unwrap ( ) ,
451+ syscall:: O_CLOEXEC | syscall:: O_STAT | syscall:: O_NOFOLLOW ) ) ?;
452+ let file = File ( FileDesc :: new ( fd) ) ;
453+ file. file_attr ( )
451454}
452455
453456pub fn canonicalize ( p : & Path ) -> io:: Result < PathBuf > {
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ pub const O_EXCL: usize = 0x0800_0000;
5555pub const O_DIRECTORY : usize = 0x1000_0000 ;
5656pub const O_STAT : usize = 0x2000_0000 ;
5757pub const O_SYMLINK : usize = 0x4000_0000 ;
58+ pub const O_NOFOLLOW : usize = 0x8000_0000 ;
5859pub const O_ACCMODE : usize = O_RDONLY | O_WRONLY | O_RDWR ;
5960
6061pub const SEEK_SET : usize = 0 ;
You can’t perform that action at this time.
0 commit comments