check properly if the IP search was successful, else leave the address empty

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@40448 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Alexander von Gluck IV 2011-02-11 20:29:19 +00:00
parent b0766602db
commit e51da86b61

View File

@ -61,19 +61,20 @@ NetworkSettings::ReadConfiguration()
{
BNetworkInterface fNetworkInterface(fName);
// Obtain possible IPv4 and IPv6 addresses
int32 zeroAddrV4 = fNetworkInterface.FindFirstAddress(AF_INET);
int32 zeroAddrV6 = fNetworkInterface.FindFirstAddress(AF_INET6);
BNetworkInterfaceAddress netIntAddr4;
BNetworkInterfaceAddress netIntAddr6;
if (zeroAddrV4 != errno) {
if (zeroAddrV4 >= 0) {
fNetworkInterface.GetAddressAt(zeroAddrV4, netIntAddr4);
fIPv4Addr = netIntAddr4.Address();
fIPv4Mask = netIntAddr4.Mask();
}
if (zeroAddrV6 != errno) {
if (zeroAddrV6 >= 0) {
fNetworkInterface.GetAddressAt(zeroAddrV6, netIntAddr6);
fIPv6Addr = netIntAddr6.Address();
fIPv6Mask = netIntAddr6.Mask();