| 162 | #[cfg(not(any(apple, target_os = "cygwin")))] |
| 163 | #[test] |
| 164 | fn invalid_offset_pwrite() { |
| 165 | use rustix::fs::{openat, Mode, OFlags, CWD}; |
| 166 | use rustix::io::pwrite; |
| 167 | let tmp = tempfile::tempdir().unwrap(); |
| 168 | let dir = openat(CWD, tmp.path(), OFlags::RDONLY, Mode::empty()).unwrap(); |
| 169 | let file = openat( |
| 170 | &dir, |
| 171 | "file", |
| 172 | OFlags::WRONLY | OFlags::TRUNC | OFlags::CREATE, |
| 173 | Mode::RUSR | Mode::WUSR, |
| 174 | ) |
| 175 | .unwrap(); |
| 176 | |
| 177 | let buf = [0_u8; 1]; |
| 178 | pwrite(&file, &buf, u64::MAX).unwrap_err(); |
| 179 | pwrite(&file, &buf, i64::MAX as u64 + 1).unwrap_err(); |
| 180 | } |
| 181 | |
| 182 | #[cfg(linux_kernel)] |
| 183 | #[test] |