From b1b61c5ef78dd090c564c7b4071a7295db160e17 Mon Sep 17 00:00:00 2001 From: llenotre Date: Wed, 29 Nov 2023 23:37:31 +0100 Subject: [PATCH] fix: uname --- src/uname.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/uname.rs b/src/uname.rs index 434c9cf..90cf5c2 100644 --- a/src/uname.rs +++ b/src/uname.rs @@ -25,7 +25,10 @@ pub struct UnameInfo { /// Turns the given buffer into a `CStr`. fn array_to_string(buf: &[c_char]) -> String { - buf.iter().map(|b| (*b) as u8 as char).collect() + buf.into_iter() + .take_while(|b| **b != 0) + .map(|b| (*b) as u8 as char) + .collect() } impl UnameInfo {