@@ -524,8 +524,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
524524 // Reject if isolation is enabled.
525525 if let IsolatedOp :: Reject ( reject_with) = this. machine . isolated_op {
526526 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 ) ;
529528 }
530529
531530 this. ffullsync_fd ( fd_num)
@@ -606,9 +605,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
606605 None => fd. read ( & fd, communicate, buf, count, dest, this) ?,
607606 Some ( offset) => {
608607 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) ;
612609 } ;
613610 fd. pread ( communicate, offset, buf, count, dest, this) ?
614611 }
@@ -650,9 +647,7 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
650647 None => fd. write ( & fd, communicate, buf, count, dest, this) ?,
651648 Some ( offset) => {
652649 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) ;
656651 } ;
657652 fd. pwrite ( communicate, buf, count, offset, dest, this) ?
658653 }
0 commit comments