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

Function invalid_offset_pwrite

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

Source from the content-addressed store, hash-verified

162#[cfg(not(any(apple, target_os = "cygwin")))]
163#[test]
164fn 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]

Callers

nothing calls this directly

Calls 3

openatFunction · 0.50
pwriteFunction · 0.50
pathMethod · 0.45

Tested by

no test coverage detected