]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/miri/src/shims/unix/thread.rs
make eval_libc functions ICE on any problem
[rust.git] / src / tools / miri / src / shims / unix / thread.rs
index 5b9dc90f0f0060c63524e4297e83aec4d8301532..4f7b028d35dbfaf6705c8b05f78933d40f300dd0 100644 (file)
@@ -84,7 +84,7 @@ fn pthread_setname_np(
 
         // Comparing with `>=` to account for null terminator.
         if name.len() >= max_name_len {
-            return this.eval_libc("ERANGE");
+            return Ok(this.eval_libc("ERANGE"));
         }
 
         this.set_thread_name(thread, name);
@@ -107,7 +107,7 @@ fn pthread_getname_np(
         let name = this.get_thread_name(thread).to_owned();
         let (success, _written) = this.write_c_str(&name, name_out, len)?;
 
-        if success { Ok(Scalar::from_u32(0)) } else { this.eval_libc("ERANGE") }
+        Ok(if success { Scalar::from_u32(0) } else { this.eval_libc("ERANGE") })
     }
 
     fn sched_yield(&mut self) -> InterpResult<'tcx, i32> {