forked from proxmox-mirrors/proxmox
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 <t.lamprecht@proxmox.com>
This commit is contained in:
parent
4be2392d59
commit
daff73bdd6
@ -213,7 +213,8 @@ pub fn make_tmp_dir<P: AsRef<Path>>(
|
||||
// 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();
|
||||
|
Loading…
Reference in New Issue
Block a user