diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index c5a19e8debe93..4dcaec6edb8ad 100644 --- a/src/libstd/sys/redox/fs.rs +++ b/src/libstd/sys/redox/fs.rs @@ -447,7 +447,10 @@ pub fn stat(p: &Path) -> io::Result { } pub fn lstat(p: &Path) -> io::Result { - 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 { diff --git a/src/libstd/sys/redox/syscall/flag.rs b/src/libstd/sys/redox/syscall/flag.rs index bd603cfe6ef9d..65ad9842d699a 100644 --- a/src/libstd/sys/redox/syscall/flag.rs +++ b/src/libstd/sys/redox/syscall/flag.rs @@ -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;