[haiku-commits] r40421 - haiku/trunk/src/kits/network/libnetapi

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 10 Feb 2011 19:13:15 +0100 (CET)

Author: axeld
Date: 2011-02-10 19:13:15 +0100 (Thu, 10 Feb 2011)
New Revision: 40421
Changeset: http://dev.haiku-os.org/changeset/40421

Modified:
   haiku/trunk/src/kits/network/libnetapi/NetworkInterface.cpp
Log:
* FindAddress(), and FindFirstAddress() now return -1 on failure.
* FindFirstAddress() did actually not specify the family to find, so that the
  stack did not have the opportunity to find anything else but the first
  address.


Modified: haiku/trunk/src/kits/network/libnetapi/NetworkInterface.cpp
===================================================================
--- haiku/trunk/src/kits/network/libnetapi/NetworkInterface.cpp 2011-02-10 
17:16:35 UTC (rev 40420)
+++ haiku/trunk/src/kits/network/libnetapi/NetworkInterface.cpp 2011-02-10 
18:13:15 UTC (rev 40421)
@@ -389,7 +389,7 @@
 {
        int socket = ::socket(address.Family(), SOCK_DGRAM, 0);
        if (socket < 0)
-               return errno;
+               return -1;
 
        FileDescriptorCloser closer(socket);
 
@@ -402,7 +402,7 @@
 
        if (ioctl(socket, B_SOCKET_GET_ALIAS, &request, sizeof(struct 
ifaliasreq))
                        < 0)
-               return errno;
+               return -1;
 
        return request.ifra_index;
 }
@@ -413,7 +413,7 @@
 {
        int socket = ::socket(family, SOCK_DGRAM, 0);
        if (socket < 0)
-               return errno;
+               return -1;
 
        FileDescriptorCloser closer(socket);
 
@@ -422,11 +422,11 @@
 
        strlcpy(request.ifra_name, Name(), IF_NAMESIZE);
        request.ifra_index = -1;
-       request.ifra_addr.ss_family = AF_UNSPEC;
+       request.ifra_addr.ss_family = family;
 
        if (ioctl(socket, B_SOCKET_GET_ALIAS, &request, sizeof(struct 
ifaliasreq))
                        < 0)
-               return errno;
+               return -1;
 
        return request.ifra_index;
 }


Other related posts:

  • » [haiku-commits] r40421 - haiku/trunk/src/kits/network/libnetapi - axeld