* Fixed broken socket_get_next_stat() that was responsible for bug #3830.

* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30500 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2009-04-30 11:59:11 +00:00
parent 218e947cde
commit 9431509f5c
2 changed files with 5 additions and 5 deletions

View File

@ -560,8 +560,11 @@ socket_get_next_stat(uint32* _cookie, int family, struct net_stat* stat)
SocketList::Iterator iterator = sSocketList.GetIterator();
uint32 cookie = *_cookie;
uint32 count = 0;
while (iterator.HasNext()) {
while (true) {
socket = iterator.Next();
if (socket == NULL)
return B_ENTRY_NOT_FOUND;
// TODO: also traverse the pending connections
if (count == cookie)
@ -571,9 +574,6 @@ socket_get_next_stat(uint32* _cookie, int family, struct net_stat* stat)
count++;
}
if (socket == NULL)
return B_ENTRY_NOT_FOUND;
*_cookie = count + 1;
stat->family = socket->family;

View File

@ -1248,7 +1248,7 @@ _user_get_next_socket_stat(int family, uint32 *_cookie, struct net_stat *_stat)
uint32 cookie;
if (!IS_USER_ADDRESS(_stat) || !IS_USER_ADDRESS(_cookie)
|| user_memcpy(&cookie, _cookie, sizeof(cookie)) != B_OK) {
|| user_memcpy(&cookie, _cookie, sizeof(cookie)) != B_OK) {
return B_BAD_ADDRESS;
}