mirror of
https://github.com/termux-pacman/termux-packages.git
synced 2026-01-07 11:23:23 +00:00
30 lines
1.5 KiB
Plaintext
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))
|
|
})
|
|
}
|