Patchwork D12373: rust-hg-core: use correct type for libc hostname buffer

login
register
mail settings
Submitter phabricator
Date March 14, 2022, 2:12 p.m.
Message ID <differential-rev-PHID-DREV-qn4lnp2ld744f76agzvd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50716/
State New
Headers show

Comments

phabricator - March 14, 2022, 2:12 p.m.
lukegb created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The type of libc::c_char is u8 on aarch64 rather than i8, which causes
  the use of a specifically-typed constant to fail.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12373

AFFECTED FILES
  rust/hg-core/src/lock.rs

CHANGE DETAILS




To: lukegb, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/lock.rs b/rust/hg-core/src/lock.rs
--- a/rust/hg-core/src/lock.rs
+++ b/rust/hg-core/src/lock.rs
@@ -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 = [libc::c_char::default(); BUFFER_SIZE];
         let hostname_bytes = unsafe {
             let result = libc::gethostname(buffer.as_mut_ptr(), BUFFER_SIZE);
             if result != 0 {