From daff73bdd644c41f3bfb22d7169824d8e5c4947e Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Tue, 21 Jan 2025 09:09:29 +0100 Subject: [PATCH] sys: use correct pointer type for mkdtemp return value The libc function mkdtemp takes a C char pointer while we previously cast our OSString buffer as i8 pointer, but that's not valid on platforms like AArch64 (ARM), where char is equivalent with a u8. Fix that by using the c_char type that was explicitly made to always get the correct, platform-independent type for C chars when doing FFI. This was reported by OJaksch on our Arch Linux User Repo (AUR) package [0]. https://aur.archlinux.org/packages/proxmox-backup-client#comment-1006851 Signed-off-by: Thomas Lamprecht --- proxmox-sys/src/fs/dir.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/proxmox-sys/src/fs/dir.rs b/proxmox-sys/src/fs/dir.rs index e4f45bbd..f8fec3a7 100644 --- a/proxmox-sys/src/fs/dir.rs +++ b/proxmox-sys/src/fs/dir.rs @@ -213,7 +213,8 @@ pub fn make_tmp_dir>( // Push NULL byte so that we have a proper NULL-terminated string template.push(0); - let returned_buffer = unsafe { libc::mkdtemp(template.as_mut_ptr() as *mut i8) }; + use std::os::raw::c_char; + let returned_buffer = unsafe { libc::mkdtemp(template.as_mut_ptr() as *mut c_char) }; // Check errno immediately, so that nothing else can overwrite it. let err = std::io::Error::last_os_error();