Permalink
Browse files

Only increase the addresses array index when adding an item to it.

  • Loading branch information...
rgulewich committed Jun 21, 2011
1 parent 3b709ff commit 620de3df2e39026dbfbf7943d55b6c5fb88c553e
Showing with 2 additions and 1 deletion.
  1. +2 −1 pcap_binding.cc
View
@@ -299,7 +299,7 @@ Pcap::FindAllDevs(const Arguments& args)
}
Local<Array> AddrArray = Array::New();
int j = 0;
- for (pcap_addr_t *cur_addr = cur_dev->addresses ; cur_addr != NULL ; cur_addr = cur_addr->next, j++) {
+ for (pcap_addr_t *cur_addr = cur_dev->addresses ; cur_addr != NULL ; cur_addr = cur_addr->next) {
if (cur_addr->addr && cur_addr->addr->sa_family == AF_INET) {
Local<Object> Address = Object::New();
@@ -319,6 +319,7 @@ Pcap::FindAllDevs(const Arguments& args)
Address->Set(String::New("dstaddr"), String::New(inet_ntoa(sin->sin_addr)));
}
AddrArray->Set(Integer::New(j), Address);
+ j++;
}
// TODO - support AF_INET6
}

0 comments on commit 620de3d

Please sign in to comment.