Skip to content

Commit 815b3ae

Browse files
committed
Auto merge of #115356 - devnexen:haiku_set_name_use_return, r=thomcc
`std::thread::set_name` exploit the return on haiku
2 parents dd24c7b + 29b8593 commit 815b3ae

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

library/std/src/sys/unix/thread.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ impl Thread {
207207
pub fn set_name(name: &CStr) {
208208
unsafe {
209209
let thread_self = libc::find_thread(ptr::null_mut());
210-
libc::rename_thread(thread_self, name.as_ptr());
210+
let res = libc::rename_thread(thread_self, name.as_ptr());
211+
// We have no good way of propagating errors here, but in debug-builds let's check that this actually worked.
212+
debug_assert_eq!(res, libc::B_OK);
211213
}
212214
}
213215

0 commit comments

Comments
 (0)