| 142 | |
| 143 | #[test] |
| 144 | fn invalid_offset_pread() { |
| 145 | use rustix::fs::{openat, Mode, OFlags, CWD}; |
| 146 | use rustix::io::pread; |
| 147 | let tmp = tempfile::tempdir().unwrap(); |
| 148 | let dir = openat(CWD, tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap(); |
| 149 | let file = openat( |
| 150 | &dir, |
| 151 | "file", |
| 152 | OFlags::RDWR | OFlags::TRUNC | OFlags::CREATE, |
| 153 | Mode::RUSR | Mode::WUSR, |
| 154 | ) |
| 155 | .unwrap(); |
| 156 | |
| 157 | let mut buf = [0_u8; 1]; |
| 158 | pread(&file, &mut buf, u64::MAX).unwrap_err(); |
| 159 | pread(&file, &mut buf, i64::MAX as u64 + 1).unwrap_err(); |
| 160 | } |
| 161 | |
| 162 | #[cfg(not(any(apple, target_os = "cygwin")))] |
| 163 | #[test] |