From 3f62ab0cc446ebb0e4ec38c5f691ba9f8783f60a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 13 Dec 2022 21:05:59 +0100 Subject: [PATCH] fix build --- src/shims/unix/fs.rs | 13 +------------ src/shims/unix/linux/fd.rs | 16 ++++++++-------- 2 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/shims/unix/fs.rs b/src/shims/unix/fs.rs index b46150e461..c46506e20a 100644 --- a/src/shims/unix/fs.rs +++ b/src/shims/unix/fs.rs @@ -381,17 +381,6 @@ trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx Ok(0) } - /// Function used when a handle is not found inside `FileHandler`. It returns `Ok(-1)`and sets - /// the last OS error to `libc::EBADF` (invalid file descriptor). This function uses - /// `T: From` instead of `i32` directly because some fs functions return different integer - /// types (like `read`, that returns an `i64`). - fn handle_not_found>(&mut self) -> InterpResult<'tcx, T> { - let this = self.eval_context_mut(); - let ebadf = this.eval_libc("EBADF"); - this.set_last_error(ebadf)?; - Ok((-1).into()) - } - fn file_type_to_d_type( &mut self, file_type: std::io::Result, @@ -737,7 +726,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { /// types (like `read`, that returns an `i64`). fn handle_not_found>(&mut self) -> InterpResult<'tcx, T> { let this = self.eval_context_mut(); - let ebadf = this.eval_libc("EBADF")?; + let ebadf = this.eval_libc("EBADF"); this.set_last_error(ebadf)?; Ok((-1).into()) } diff --git a/src/shims/unix/linux/fd.rs b/src/shims/unix/linux/fd.rs index d3be65f2e0..212b793634 100644 --- a/src/shims/unix/linux/fd.rs +++ b/src/shims/unix/linux/fd.rs @@ -26,7 +26,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let flags = this.read_scalar(flags)?.to_i32()?; - let epoll_cloexec = this.eval_libc_i32("EPOLL_CLOEXEC")?; + let epoll_cloexec = this.eval_libc_i32("EPOLL_CLOEXEC"); if flags == epoll_cloexec { // Miri does not support exec, so this flag has no effect. } else if flags != 0 { @@ -64,9 +64,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let fd = this.read_scalar(fd)?.to_i32()?; let _event = this.read_scalar(event)?.to_pointer(this)?; - let epoll_ctl_add = this.eval_libc_i32("EPOLL_CTL_ADD")?; - let epoll_ctl_mod = this.eval_libc_i32("EPOLL_CTL_MOD")?; - let epoll_ctl_del = this.eval_libc_i32("EPOLL_CTL_DEL")?; + let epoll_ctl_add = this.eval_libc_i32("EPOLL_CTL_ADD"); + let epoll_ctl_mod = this.eval_libc_i32("EPOLL_CTL_MOD"); + let epoll_ctl_del = this.eval_libc_i32("EPOLL_CTL_DEL"); if op == epoll_ctl_add || op == epoll_ctl_mod { let event = this.deref_operand(event)?; @@ -95,7 +95,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { Ok(Scalar::from_i32(this.handle_not_found()?)) } } else { - let einval = this.eval_libc("EINVAL")?; + let einval = this.eval_libc("EINVAL"); this.set_last_error(einval)?; Ok(Scalar::from_i32(-1)) } @@ -127,9 +127,9 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> { let val = this.read_scalar(val)?.to_u32()?; let flags = this.read_scalar(flags)?.to_i32()?; - let efd_cloexec = this.eval_libc_i32("EFD_CLOEXEC")?; - let efd_nonblock = this.eval_libc_i32("EFD_NONBLOCK")?; - let efd_semaphore = this.eval_libc_i32("EFD_SEMAPHORE")?; + let efd_cloexec = this.eval_libc_i32("EFD_CLOEXEC"); + let efd_nonblock = this.eval_libc_i32("EFD_NONBLOCK"); + let efd_semaphore = this.eval_libc_i32("EFD_SEMAPHORE"); if flags & (efd_cloexec | efd_nonblock | efd_semaphore) == 0 { throw_unsup_format!("{flags} is unsupported");