tools/xattr: a char from C is not universally a rust i8
Make it actually do the correct cast by using `libc::c_char`. Fixes issues when building on other platforms, e.g., the aarch64 client only build on Arch Linux ARM I tested in my free time. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
217c22c754
commit
449e4a66fe
@ -82,7 +82,7 @@ pub fn flistxattr(fd: RawFd) -> Result<ListXAttr, nix::errno::Errno> {
|
|||||||
let mut size = 256;
|
let mut size = 256;
|
||||||
let mut buffer = vec::undefined(size);
|
let mut buffer = vec::undefined(size);
|
||||||
let mut bytes = unsafe {
|
let mut bytes = unsafe {
|
||||||
libc::flistxattr(fd, buffer.as_mut_ptr() as *mut i8, buffer.len())
|
libc::flistxattr(fd, buffer.as_mut_ptr() as *mut libc::c_char, buffer.len())
|
||||||
};
|
};
|
||||||
while bytes < 0 {
|
while bytes < 0 {
|
||||||
let err = Errno::last();
|
let err = Errno::last();
|
||||||
@ -96,7 +96,7 @@ pub fn flistxattr(fd: RawFd) -> Result<ListXAttr, nix::errno::Errno> {
|
|||||||
// Retry to read the list with new buffer
|
// Retry to read the list with new buffer
|
||||||
buffer.resize(size, 0);
|
buffer.resize(size, 0);
|
||||||
bytes = unsafe {
|
bytes = unsafe {
|
||||||
libc::flistxattr(fd, buffer.as_mut_ptr() as *mut i8, buffer.len())
|
libc::flistxattr(fd, buffer.as_mut_ptr() as *mut libc::c_char, buffer.len())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
buffer.truncate(bytes as usize);
|
buffer.truncate(bytes as usize);
|
||||||
@ -125,7 +125,7 @@ pub fn fgetxattr(fd: RawFd, name: &CStr) -> Result<Vec<u8>, nix::errno::Errno> {
|
|||||||
}
|
}
|
||||||
buffer.resize(size, 0);
|
buffer.resize(size, 0);
|
||||||
bytes = unsafe {
|
bytes = unsafe {
|
||||||
libc::fgetxattr(fd, name.as_ptr() as *const i8, buffer.as_mut_ptr() as *mut core::ffi::c_void, buffer.len())
|
libc::fgetxattr(fd, name.as_ptr() as *const libc::c_char, buffer.as_mut_ptr() as *mut core::ffi::c_void, buffer.len())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
buffer.resize(bytes as usize, 0);
|
buffer.resize(bytes as usize, 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user