Skip to content

Commit ddb6ea4

Browse files
committed
Fix compilation when using IpV4 or IpV6 specific configuration.
Fixes eng/toolchain/aws#42
1 parent e6b33e3 commit ddb6ea4

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

config/src/aws-net-std__ipv4.adb

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@ package body AWS.Net.Std is
6565
-- Set the socket to the non-blocking mode.
6666
-- AWS is not using blocking sockets internally.
6767

68-
To_GNAT : constant array (Family_Type) of Sockets.Family_Type :=
69-
(Family_Inet => Sockets.Family_Inet,
70-
Family_Inet6 => Sockets.Family_Inet6,
71-
Family_Unspec => Sockets.Family_Inet);
72-
7368
-------------------
7469
-- Accept_Socket --
7570
-------------------
@@ -143,8 +138,7 @@ package body AWS.Net.Std is
143138

144139
Sockets.Bind_Socket
145140
(Socket.S.FD,
146-
(To_GNAT (Family), Inet_Addr, Sockets.Port_Type (Port)));
147-
141+
(Sockets.Family_Inet, Inet_Addr, Sockets.Port_Type (Port)));
148142
exception
149143
when E : Sockets.Socket_Error | Sockets.Host_Error =>
150144
if Created then
@@ -210,7 +204,7 @@ package body AWS.Net.Std is
210204

211205
Socket.S := new Socket_Hidden;
212206

213-
Sock_Addr := (To_GNAT (Family),
207+
Sock_Addr := (Sockets.Family_Inet,
214208
Get_Inet_Addr (Host, Passive => False),
215209
Sockets.Port_Type (Port));
216210

config/src/aws-net-std__ipv6.adb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,9 +919,12 @@ package body AWS.Net.Std is
919919
-----------------------
920920

921921
overriding procedure Set_Close_On_Exec (Socket : Socket_Type) is
922-
Status : Boolean;
922+
function C_Set_Close_On_Exec
923+
(Socket : C.int; Close_On_Exec : C.int) return C.int;
924+
pragma Import (C, C_Set_Close_On_Exec, "__gnat_set_close_on_exec");
925+
Res : C.int := 0 with Unreferenced;
923926
begin
924-
Sockets.Set_Close_On_Exec (Socket.S.FD, True, Status);
927+
Res := C_Set_Close_On_Exec (Socket.S.FD, 1);
925928
end Set_Close_On_Exec;
926929

927930
----------------------

templates_parser

0 commit comments

Comments
 (0)