Skip to content

Commit 2f25e4c

Browse files
committed
Error with EINVAL on unsupported whence argument
1 parent 0d0902a commit 2f25e4c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/shims/fs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
285285
} else if whence == this.eval_libc_i32("SEEK_END")? {
286286
SeekFrom::End(offset)
287287
} else {
288-
throw_unsup_format!("Unsupported whence argument to lseek64: {}", whence)
288+
let einval = this.eval_libc("EINVAL")?;
289+
this.set_last_error(einval)?;
290+
return Ok(-1);
289291
};
290292

291293
if let Some(handle) = this.machine.file_handler.handles.get_mut(&fd) {

0 commit comments

Comments
 (0)