File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ features = ["all"]
38
38
libc = " 0.2.150"
39
39
40
40
[target .'cfg(windows)' .dependencies .windows-sys ]
41
- version = " 0.52"
41
+ version = " >= 0.52,<0.60 "
42
42
features = [
43
43
" Win32_Foundation" ,
44
44
" Win32_Networking_WinSock" ,
Original file line number Diff line number Diff line change @@ -930,6 +930,17 @@ pub(crate) fn unix_sockaddr(path: &Path) -> io::Result<SockAddr> {
930
930
}
931
931
932
932
storage. sun_family = crate :: sys:: AF_UNIX as sa_family_t ;
933
+
934
+ // `windows-sys` 0.52.* represents `SOCKADDR_UN::sun_path` as `&[u8]`, but 0.59.*
935
+ // represents it as `&[i8]`.
936
+ //
937
+ // TODO: Remove this once `windows-sys` 0.52.* is no longer
938
+ // permitted as a dependency.
939
+ //
940
+ // SAFETY: We are safe in doing this, because: `bytes` starts as `&[u8]`, and is converted
941
+ // to a `&[u8]` or `&[i8]`, and all of these types have the same size and alignment.
942
+ let bytes = unsafe { slice:: from_raw_parts ( bytes. as_ptr ( ) . cast ( ) , bytes. len ( ) ) } ;
943
+
933
944
// `storage` was initialized to zero above, so the path is
934
945
// already null terminated.
935
946
storage. sun_path [ ..bytes. len ( ) ] . copy_from_slice ( bytes) ;
You can’t perform that action at this time.
0 commit comments