From 3fbbbd1e874d3dd74ba551b8ff7f1ed04321a3ed Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Thu, 20 Nov 2014 15:37:41 +0100 Subject: [multiple changes] 2014-11-20 Thomas Quinot * g-socket.adb (To_Host_Entry): Guard against case of a non-AF_INET entry. 2014-11-20 Vadim Godunko * a-strunb-shared.adb (To_Unbounded_String): Use shared empty object to construct return value when source string is empty or requested length is zero. * a-stwiun-shared.adb (To_Unbounded_Wide_String): Likewise. * a-stzunb-shared.adb (To_Unbounded_Wide_Wide_String): Likewise. 2014-11-20 Yannick Moy * a-cfhase.adb, a-cfinve.adb, a-cforma.adb, a-cfhama.adb, a-cforse.adb, a-cofove.adb: Skip CodePeer analysis on body of all formal containers. 2014-11-20 Arnaud Charlet * adaint.c: Fix typo. * exp_util.adb (Make_Subtype_From_Expr): Complete previous change, generate constant values. * sem_eval.adb (Decompose_Expr): Fix latent bug leading to a wrong evaluation to '0' of some unknown values. 2014-11-20 Robert Dewar * repinfo.adb (List_Record_Info): Do not list discriminant in unchecked union. * sem_ch13.adb (Has_Good_Profile): Minor reformatting (Analyze_Stream_TSS_Definition): Minor reformatting (Analyze_Record_Representation_Clause): Do not issue warning for missing rep clause for discriminant in unchecked union. From-SVN: r217861 --- gcc/ada/g-socket.adb | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'gcc/ada/g-socket.adb') diff --git a/gcc/ada/g-socket.adb b/gcc/ada/g-socket.adb index 9412517..3a10c9c 100644 --- a/gcc/ada/g-socket.adb +++ b/gcc/ada/g-socket.adb @@ -976,11 +976,17 @@ package body GNAT.Sockets is Raise_Host_Error (Integer (Err)); end if; - return H : constant Host_Entry_Type := - To_Host_Entry (Res'Unchecked_Access) - do - Netdb_Unlock; - end return; + begin + return H : constant Host_Entry_Type := + To_Host_Entry (Res'Unchecked_Access) + do + Netdb_Unlock; + end return; + exception + when others => + Netdb_Unlock; + raise; + end; end Get_Host_By_Address; ---------------------- @@ -2420,9 +2426,13 @@ package body GNAT.Sockets is Aliases_Count, Addresses_Count : Natural; -- H_Length is not used because it is currently only ever set to 4, as - -- H_Addrtype is always AF_INET. + -- we only handle the case of H_Addrtype being AF_INET. begin + if Hostent_H_Addrtype (E) /= SOSC.AF_INET then + Raise_Socket_Error (SOSC.EPFNOSUPPORT); + end if; + Aliases_Count := 0; while Hostent_H_Alias (E, C.int (Aliases_Count)) /= Null_Address loop Aliases_Count := Aliases_Count + 1; -- cgit v1.1