@@ -524,8 +524,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
524
524
// Reject if isolation is enabled.
525
525
if let IsolatedOp :: Reject ( reject_with) = this. machine . isolated_op {
526
526
this. reject_in_isolation ( "`fcntl`" , reject_with) ?;
527
- this. set_last_error ( ErrorKind :: PermissionDenied ) ?;
528
- return Ok ( Scalar :: from_i32 ( -1 ) ) ;
527
+ return this. set_last_error_and_return_i32 ( ErrorKind :: PermissionDenied ) ;
529
528
}
530
529
531
530
this. ffullsync_fd ( fd_num)
@@ -606,9 +605,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
606
605
None => fd. read ( & fd, communicate, buf, count, dest, this) ?,
607
606
Some ( offset) => {
608
607
let Ok ( offset) = u64:: try_from ( offset) else {
609
- this. set_last_error ( LibcError ( "EINVAL" ) ) ?;
610
- this. write_int ( -1 , dest) ?;
611
- return Ok ( ( ) ) ;
608
+ return this. set_last_error_and_return ( LibcError ( "EINVAL" ) , dest) ;
612
609
} ;
613
610
fd. pread ( communicate, offset, buf, count, dest, this) ?
614
611
}
@@ -650,9 +647,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
650
647
None => fd. write ( & fd, communicate, buf, count, dest, this) ?,
651
648
Some ( offset) => {
652
649
let Ok ( offset) = u64:: try_from ( offset) else {
653
- this. set_last_error ( LibcError ( "EINVAL" ) ) ?;
654
- this. write_int ( -1 , dest) ?;
655
- return Ok ( ( ) ) ;
650
+ return this. set_last_error_and_return ( LibcError ( "EINVAL" ) , dest) ;
656
651
} ;
657
652
fd. pwrite ( communicate, buf, count, offset, dest, this) ?
658
653
}
0 commit comments