diff --git a/0001-Cast-gethostname-arguments-to-a-proper-type.patch b/0001-Cast-gethostname-arguments-to-a-proper-type.patch index cd3f6da..d30b40b 100644 --- a/0001-Cast-gethostname-arguments-to-a-proper-type.patch +++ b/0001-Cast-gethostname-arguments-to-a-proper-type.patch @@ -1,4 +1,4 @@ -From f7c398680b57b3fce0584314ac255e45ef1bd932 Mon Sep 17 00:00:00 2001 +From 0b78f6160ccb7c3f7fcc10e56defca051c249c61 Mon Sep 17 00:00:00 2001 From: Igor Raits Date: Sat, 15 Feb 2020 11:38:40 +0100 Subject: [PATCH] Cast gethostname() arguments to a proper type @@ -6,14 +6,14 @@ Subject: [PATCH] Cast gethostname() arguments to a proper type Closes: https://github.com/FillZpp/sys-info-rs/issues/43 Signed-off-by: Igor Raits --- - lib.rs | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) + lib.rs | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib.rs b/lib.rs -index b26bb9f..8bb1891 100644 +index b26bb9f..11b3547 100644 --- a/lib.rs +++ b/lib.rs -@@ -395,7 +395,7 @@ pub fn hostname() -> Result { +@@ -395,10 +395,10 @@ pub fn hostname() -> Result { unsafe { let buf_size = libc::sysconf(libc::_SC_HOST_NAME_MAX) as usize; let mut buf = Vec::::with_capacity(buf_size + 1); @@ -21,7 +21,11 @@ index b26bb9f..8bb1891 100644 + if libc::gethostname(buf.as_mut_ptr() as *mut libc::c_char, buf_size) < 0 { return Err(Error::IO(io::Error::last_os_error())); } - let hostname_len = libc::strnlen(buf.as_ptr() as *const i8, buf_size); +- let hostname_len = libc::strnlen(buf.as_ptr() as *const i8, buf_size); ++ let hostname_len = libc::strnlen(buf.as_ptr() as *const libc::c_char, buf_size); + buf.set_len(hostname_len); + Ok(ffi::CString::new(buf).unwrap().into_string().unwrap()) + } -- 2.25.0