rust-hg-core: use correct type for libc hostname buffer stable
authorLuke Granger-Brown <hg@lukegb.com>
Mon, 14 Mar 2022 14:10:41 +0000
branchstable
changeset 48962 59be65b7cdfd
parent 48807 1ceca11e6546
child 48964 9ce563fb2989
rust-hg-core: use correct type for libc hostname buffer The type of libc::c_char is u8 on aarch64 rather than i8, which causes the use of a specifically-typed constant to fail. Differential Revision: https://phab.mercurial-scm.org/D12373
rust/hg-core/src/lock.rs
--- a/rust/hg-core/src/lock.rs	Tue Mar 01 16:39:14 2022 +0100
+++ b/rust/hg-core/src/lock.rs	Mon Mar 14 14:10:41 2022 +0000
@@ -145,7 +145,7 @@
 
         /// Same as https://github.com/python/cpython/blob/v3.10.0/Modules/socketmodule.c#L5414
         const BUFFER_SIZE: usize = 1024;
-        let mut buffer = [0_i8; BUFFER_SIZE];
+        let mut buffer = [0 as libc::c_char; BUFFER_SIZE];
         let hostname_bytes = unsafe {
             let result = libc::gethostname(buffer.as_mut_ptr(), BUFFER_SIZE);
             if result != 0 {