diff options
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/libgnat/g-socket.adb | 13 |
2 files changed, 14 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6cb5389..81b5db9 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-03-22 Dmitriy Anisimkov <anisimko@adacore.com> + + PR ada/89583 + * libgnat/g-socket.adb (Bind_Socket, Connect_Socket, + Send_Socket): Fix the computation of structure lengths passed to + low level routines. + (Is_IPv6_Address): Fix the number of expected colons. + 2019-03-11 Martin Liska <mliska@suse.cz> * gcc-interface/misc.c (gnat_post_options): Wrap option name in string diff --git a/gcc/ada/libgnat/g-socket.adb b/gcc/ada/libgnat/g-socket.adb index c0b3079..476a213 100644 --- a/gcc/ada/libgnat/g-socket.adb +++ b/gcc/ada/libgnat/g-socket.adb @@ -461,12 +461,12 @@ package body GNAT.Sockets is is Res : C.int; Sin : aliased Sockaddr; - Len : constant C.int := Sin'Size / 8; begin Set_Address (Sin'Unchecked_Access, Address); - Res := C_Bind (C.int (Socket), Sin'Address, Len); + Res := C_Bind + (C.int (Socket), Sin'Address, C.int (Lengths (Address.Family))); if Res = Failure then Raise_Socket_Error (Socket_Errno); @@ -666,12 +666,11 @@ package body GNAT.Sockets is Server : Sock_Addr_Type) return C.int is Sin : aliased Sockaddr; - Len : constant C.int := Sin'Size / 8; - begin Set_Address (Sin'Unchecked_Access, Server); - return C_Connect (C.int (Socket), Sin'Address, Len); + return C_Connect + (C.int (Socket), Sin'Address, C.int (Lengths (Server.Family))); end Connect_Socket; procedure Connect_Socket @@ -1794,7 +1793,7 @@ package body GNAT.Sockets is end if; end loop; - return Colons <= 7; + return Colons <= 8; end Is_IPv6_Address; --------------------- @@ -2403,7 +2402,7 @@ package body GNAT.Sockets is if To /= null then Set_Address (Sin'Unchecked_Access, To.all); C_To := Sin'Address; - Len := Sin'Size / 8; + Len := C.int (Thin_Common.Lengths (To.Family)); else C_To := System.Null_Address; |