From 9be617132a89b3d6c3f42dd8fe7441b596f7bca0 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Sun, 20 Apr 2025 14:09:31 +0200 Subject: [PATCH] Fix 'sys:exe' as required by libstd. --- src/scheme/proc.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs index a798257ee8..f1ce8966ce 100644 --- a/src/scheme/proc.rs +++ b/src/scheme/proc.rs @@ -1122,9 +1122,16 @@ impl ContextHandle { let info = unsafe { buf.read_exact::()? }; let mut guard = context.write(); - // length must statically match - guard.name = ArrayString::from_byte_string(&info.debug_name) + let len = info + .debug_name + .iter() + .position(|c| *c == 0) + .unwrap_or(info.debug_name.len()) + .min(guard.name.capacity()); + let debug_name = core::str::from_utf8(&info.debug_name[..len]) .map_err(|_| Error::new(EINVAL))?; + guard.name.clear(); + guard.name.push_str(debug_name); guard.pid = info.pid as usize; guard.ens = (info.ens as usize).into();