Skip to content

Commit

Permalink
src: return empty set on ENOSYS for interfaces
Browse files Browse the repository at this point in the history
If node was compiled with --no-ifaddrs to support older operating
systems, don't throw instead simply return an empty object

Fixes #6846
  • Loading branch information
tjfontaine committed Jan 12, 2014
1 parent 196184d commit 8753bb3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/node_os.cc
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,14 @@ static Handle<Value> GetInterfaceAddresses(const Arguments& args) {

uv_err_t err = uv_interface_addresses(&interfaces, &count);

ret = Object::New();

if (err.code == UV_ENOSYS)
return scope.Close(ret);

if (err.code != UV_OK)
return ThrowException(UVException(err.code, "uv_interface_addresses"));

ret = Object::New();

for (i = 0; i < count; i++) {
name = String::New(interfaces[i].name);
if (ret->Has(name)) {
Expand Down

0 comments on commit 8753bb3

Please sign in to comment.