Skip to content

Commit

Permalink
getifaddrs: don't fail if there are no interfaces.
Browse files Browse the repository at this point in the history
* This is not an error, just return an empty list.
* Same behavior as *BSD implementation.
  • Loading branch information
pulkomandy committed Jul 29, 2015
1 parent 2df7158 commit f93dab0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/kits/network/getifaddrs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ getifaddrs(struct ifaddrs** _ifaddrs)

size_t count = (size_t)config.ifc_value;
if (count == 0) {
errno = B_BAD_VALUE;
return -1;
// No interfaces found
*_ifaddrs = NULL;
return 0;
}

// Allocate a buffer for ifreqs for all interfaces
Expand Down

0 comments on commit f93dab0

Please sign in to comment.