Cleanup cstr implementation

This commit is contained in:
topjohnwu
2025-04-21 15:59:56 -07:00
committed by John Wu
parent c8a16b0e0c
commit c34c7838bb
3 changed files with 88 additions and 179 deletions

View File

@@ -84,7 +84,7 @@ fn file_set_prop(name: &Utf8CStr, value: Option<&Utf8CStr>) -> LoggedResult<()>
.join("prop.XXXXXX");
{
let mut f = unsafe {
mkstemp(tmp.as_mut_ptr())
mkstemp(tmp.0.as_mut_ptr())
.as_os_result("mkstemp", None, None)
.map(|fd| File::from_raw_fd(fd))?
};
@@ -114,7 +114,7 @@ fn proto_write_props(props: &PersistentProperties) -> LoggedResult<()> {
let mut tmp = FsPathBuf::default().join(concatcp!(PERSIST_PROP, ".XXXXXX"));
{
let f = unsafe {
mkstemp(tmp.as_mut_ptr())
mkstemp(tmp.0.as_mut_ptr())
.as_os_result("mkstemp", None, None)
.map(|fd| File::from_raw_fd(fd))?
};