Skip to content

Commit f71a211

Browse files
committed
Fix isolation code
1 parent f5bc58c commit f71a211

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/shims/env.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
474474
"`getpid` is only available for the UNIX target family"
475475
);
476476

477-
if let IsolatedOp::Reject(reject_with) = this.machine.isolated_op {
478-
this.reject_in_isolation("getpid", reject_with)?;
479-
this.set_last_error_from_io_error(ErrorKind::PermissionDenied)?;
477+
this.check_no_isolation("`getpid`")?;
480478

481-
return Ok(-1);
482-
}
483479
// The reason we need to do this wacky of a conversion is because
484480
// `libc::getpid` returns an i32, however, `std::process::id()` return an u32,
485481
// So we need to fit that u32 into an i32 and pray
@@ -495,11 +491,8 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
495491
let this = self.eval_context_mut();
496492
this.assert_target_os("windows", "GetProcessId");
497493

498-
if let IsolatedOp::Reject(reject_with) = this.machine.isolated_op {
499-
this.reject_in_isolation("`GetProcessId`", reject_with)?;
500-
this.set_last_error_from_io_error(ErrorKind::PermissionDenied)?;
501-
return Ok(0);
502-
}
494+
this.check_no_isolation("`GetCurrentProcessId`")?;
495+
503496

504497
Ok(std::process::id())
505498
}

0 commit comments

Comments
 (0)