diff options
author | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-01-12 10:04:21 -0800 |
---|---|---|
committer | Timothy J Fontaine <tjfontaine@gmail.com> | 2014-01-12 10:04:21 -0800 |
commit | 8753bb38596f7148d0cf60b8c1ccad7db4eef609 (patch) | |
tree | f8061ab9c622ec31e3616c4c7433ed5c2e20e53b | |
parent | 196184d332ba2d2defc56ad0b37653659a7d3ec0 (diff) | |
download | node-8753bb38596f7148d0cf60b8c1ccad7db4eef609.tar.gz |
src: return empty set on ENOSYS for interfaces
If node was compiled with --no-ifaddrs to support older operating
systems, don't throw instead simply return an empty object
Fixes #6846
-rw-r--r-- | src/node_os.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/node_os.cc b/src/node_os.cc index 4b325d820..07f73f4b7 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -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)) { |