MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / invalid_offset_pread

Function invalid_offset_pread

tests/fs/invalid_offset.rs:144–160  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

142
143#[test]
144fn 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]

Callers

nothing calls this directly

Calls 3

openatFunction · 0.50
preadFunction · 0.50
pathMethod · 0.45

Tested by

no test coverage detected