* 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:
parent
218e947cde
commit
9431509f5c
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user