diff options
| author | bors <bors@rust-lang.org> | 2023-11-01 07:53:49 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-01 07:53:49 +0000 |
| commit | 815b3ae00a315af1171b2ce371e04518bf746860 (patch) | |
| tree | 62e53e981bf5932255938d18e2bdbb564fa00647 | |
| parent | dd24c7bdbf94f0d64b449a74b8c57702b69abd33 (diff) | |
| parent | 29b859335bf41c3037a9f5d386fef1c951259c3c (diff) | |
| download | rust-815b3ae00a315af1171b2ce371e04518bf746860.tar.gz rust-815b3ae00a315af1171b2ce371e04518bf746860.zip | |
Auto merge of #115356 - devnexen:haiku_set_name_use_return, r=thomcc
`std::thread::set_name` exploit the return on haiku
| -rw-r--r-- | library/std/src/sys/unix/thread.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/library/std/src/sys/unix/thread.rs b/library/std/src/sys/unix/thread.rs index e667f34aece..29db9468e5f 100644 --- a/library/std/src/sys/unix/thread.rs +++ b/library/std/src/sys/unix/thread.rs @@ -207,7 +207,9 @@ impl Thread { pub fn set_name(name: &CStr) { unsafe { let thread_self = libc::find_thread(ptr::null_mut()); - libc::rename_thread(thread_self, name.as_ptr()); + let res = libc::rename_thread(thread_self, name.as_ptr()); + // We have no good way of propagating errors here, but in debug-builds let's check that this actually worked. + debug_assert_eq!(res, libc::B_OK); } } |
