fix mount() not converting data to CString

This commit is contained in:
Ryan Heywood 2025-07-11 18:54:24 -04:00
parent 17a3f77733
commit 46b1ab1dd8
Signed by: ryan
GPG Key ID: 8E401478A3FBEF72
1 changed files with 7 additions and 1 deletions

View File

@ -36,7 +36,13 @@ pub fn mount(
target = target.display()
))?;
let fstype_cs = CString::new(fstype).context(format_args!("bad fstype: {fstype}"))?;
let data_ptr = if let Some(s) = data {
let data_cs = data
.map(CString::new)
.transpose()
.context(format_args!("bad data: {data:?}"))?;
let data_ptr = if let Some(s) = data_cs {
s.as_ptr()
} else {
std::ptr::null()