X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Socket%2FProtocols%2FINet%2FINet4Address.cc;h=6d75b16b2ab65ed855f620e836f494b0d7d0c2d0;hb=a1a6c76a214ad1935032826713cabaf9ac57bf07;hp=f6b53627503fa83a3ed7b49011ea15aabad0a5c1;hpb=c75c285e1d33a5394c7f7d3cb437bd01da7d888e;p=senf.git diff --git a/Socket/Protocols/INet/INet4Address.cc b/Socket/Protocols/INet/INet4Address.cc index f6b5362..6d75b16 100644 --- a/Socket/Protocols/INet/INet4Address.cc +++ b/Socket/Protocols/INet/INet4Address.cc @@ -1,8 +1,8 @@ // $Id$ // -// Copyright (C) 2007 -// Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS) -// Kompetenzzentrum fuer Satelitenkommunikation (SatCom) +// Copyright (C) 2007 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY // Stefan Bund // // This program is free software; you can redistribute it and/or modify @@ -31,7 +31,7 @@ #include #include #include -#ifdef _REENTRANT +#if defined(_REENTRANT) && !defined(__GLIBC__) #include #endif @@ -52,10 +52,14 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s struct in_addr ina; if (::inet_pton(AF_INET,s.c_str(),&ina) > 0) return senf::INet4Address::from_inaddr(ina.s_addr); + + if (s.empty()) + throw SyntaxException(); + int herr (0); // If available, we use the reentrant GNU variant. This has the additional advantage, that we - // can explicitly ask for IpV4 addresses + // can explicitly ask for IPv4 addresses # ifdef __GLIBC__ @@ -76,10 +80,9 @@ prefix_ senf::INet4Address senf::INet4Address::from_string(std::string const & s # endif // __GLIBC__ if (!ent) - ///\fixme Need to give better exception here - throw SyntaxException(); + throw UnknownHostnameException(); if (ent->h_addrtype != AF_INET) - throw SyntaxException(); + throw UnknownHostnameException(); // We are only interested in the first address ... return senf::INet4Address::from_inaddr(