Files
termux-packages/packages/miniserve/socket2-0.5.2-src-sys-unix.rs.diff32
termux-pacman-bot fa40e0bdc5 miniserve: Fix build for 32-bit arches
No need to bump revision.
2023-04-18 02:37:04 +00:00

30 lines
1.5 KiB
Plaintext

--- a/src/sys/unix.rs
+++ b/src/sys/unix.rs
@@ -691,7 +691,7 @@
pub fn is_unnamed(&self) -> bool {
self.as_sockaddr_un()
.map(|storage| {
- self.len() == offset_of_path(storage) as u32
+ self.len() == (offset_of_path(storage) as u32).try_into().unwrap()
// On some non-linux platforms a zeroed path is returned for unnamed.
// Abstract addresses only exist on Linux.
// NOTE: although Fuchsia does define `AF_UNIX` it's not actually implemented.
@@ -754,7 +754,7 @@
/// pathname address, otherwise returns `None`.
pub fn as_pathname(&self) -> Option<&Path> {
self.as_sockaddr_un().and_then(|storage| {
- (self.len() > offset_of_path(storage) as u32 && storage.sun_path[0] != 0).then(|| {
+ (self.len() > (offset_of_path(storage) as u32).try_into().unwrap() && storage.sun_path[0] != 0).then(|| {
let path_slice = self.path_bytes(storage, false);
Path::new::<OsStr>(OsStrExt::from_bytes(path_slice))
})
@@ -772,7 +772,7 @@
#[cfg(any(target_os = "linux", target_os = "android"))]
{
self.as_sockaddr_un().and_then(|storage| {
- (self.len() > offset_of_path(storage) as u32 && storage.sun_path[0] == 0)
+ (self.len() > (offset_of_path(storage) as u32).try_into().unwrap() && storage.sun_path[0] == 0)
.then(|| self.path_bytes(storage, true))
})
}