diff options
| author | bors <bors@rust-lang.org> | 2017-07-12 00:49:51 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-07-12 00:49:51 +0000 |
| commit | cd71ea733849e1a130f965f8f5f3515fdcd4b961 (patch) | |
| tree | 2c18e1fcc858627606748d047a61f48b375e7641 /src/libstd | |
| parent | b360b44ecffc628b95c211360972ec39c9046876 (diff) | |
| parent | 51260f4a6d7298468c2bfc26e8e77378d33caf9b (diff) | |
| download | rust-cd71ea733849e1a130f965f8f5f3515fdcd4b961.tar.gz rust-cd71ea733849e1a130f965f8f5f3515fdcd4b961.zip | |
Auto merge of #43056 - ids1024:nofollow2, r=burntsushi
Redox: Use O_NOFOLLOW for lstat()
Diffstat (limited to 'src/libstd')
| -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; |
