diff options
| author | Ian Douglas Scott <ian@iandouglasscott.com> | 2017-07-03 19:21:03 -0700 |
|---|---|---|
| committer | Ian Douglas Scott <ian@iandouglasscott.com> | 2017-07-11 15:05:17 -0700 |
| commit | 51260f4a6d7298468c2bfc26e8e77378d33caf9b (patch) | |
| tree | c3aa8211bfc36d10c2c2395ff2b75c85a55a93cd | |
| parent | 9475ae477a4d42c564eab9621ffb6aa7c160a3dc (diff) | |
| download | rust-51260f4a6d7298468c2bfc26e8e77378d33caf9b.tar.gz rust-51260f4a6d7298468c2bfc26e8e77378d33caf9b.zip | |
Redox: Use O_NOFOLLOW for lstat()
| -rw-r--r-- | src/libstd/sys/redox/fs.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sys/redox/syscall/flag.rs | 1 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/libstd/sys/redox/fs.rs b/src/libstd/sys/redox/fs.rs index c5a19e8debe..4dcaec6edb8 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<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> { diff --git a/src/libstd/sys/redox/syscall/flag.rs b/src/libstd/sys/redox/syscall/flag.rs index bd603cfe6ef..65ad9842d69 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; |
