Skip to content

Commit

Permalink
fix: uname
Browse files Browse the repository at this point in the history
  • Loading branch information
llenotre committed Nov 29, 2023
1 parent 1d6c1ed commit b1b61c5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/uname.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b1b61c5

Please sign in to comment.