]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
Merge pull request #228 from g2p/non-utf8-printbuf-display
authorkoverstreet <kent.overstreet@gmail.com>
Mon, 29 Jan 2024 17:19:16 +0000 (12:19 -0500)
committerGitHub <noreply@github.com>
Mon, 29 Jan 2024 17:19:16 +0000 (12:19 -0500)
printbuf_to_formatter: Lossy display of non-UTF-8 printbufs

bch_bindgen/src/lib.rs

index deb69a5169907124e6f19e9d5baa9e2c1b995cf2..ea49e60beed35b548d3d7c50b4a3fd4eaf2c0ebf 100644 (file)
@@ -164,5 +164,5 @@ pub fn printbuf_to_formatter<F>(f: &mut fmt::Formatter<'_>, func: F) -> fmt::Res
     func(&mut buf);
 
     let s = unsafe { CStr::from_ptr(buf.buf) };
-    f.write_str(s.to_str().unwrap())
+    f.write_str(&s.to_string_lossy())
 }