Fix error in logic of populating ports array

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35187 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2012-06-08 15:48:10 +00:00
parent 9147ca7e33
commit ff4697151d
2 changed files with 22 additions and 18 deletions

View file

@ -1423,18 +1423,16 @@ typedef struct {
M_LOCK(myLock);
*count = NSCountMapTable(handles);
/*
* Put in our listening socket.
*/
if (lDesc >= 0)
{
*count = *count + 1;
if (pos < limit)
{
fds[pos++] = lDesc;
fds[pos] = lDesc;
}
pos++;
}
/*
@ -1445,14 +1443,18 @@ typedef struct {
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, &sock, (void**)&handle))
{
if (handle->recvPort == recvSelf
&& pos < limit)
{
fds[pos++] = (int)(intptr_t)sock;
}
if (handle->recvPort == recvSelf)
{
if (pos < limit)
{
fds[pos] = (int)(intptr_t)sock;
}
pos++;
}
}
NSEndMapTableEnumeration(&me);
M_UNLOCK(myLock);
*count = pos;
}
- (id) conversation: (NSPort*)recvPort

View file

@ -1858,18 +1858,16 @@ static Class tcpPortClass;
M_LOCK(myLock);
*count = NSCountMapTable(handles);
/*
* Put in our listening socket.
*/
if (listener >= 0)
{
*count = *count + 1;
if (pos < limit)
{
fds[pos++] = listener;
fds[pos] = listener;
}
pos++;
}
/*
@ -1880,14 +1878,18 @@ static Class tcpPortClass;
me = NSEnumerateMapTable(handles);
while (NSNextMapEnumeratorPair(&me, &sock, (void**)&handle))
{
if (handle->recvPort == recvSelf
&& pos < limit)
{
fds[pos++] = (int)(intptr_t)sock;
}
if (handle->recvPort == recvSelf)
{
if (pos < limit)
{
fds[pos] = (int)(intptr_t)sock;
}
pos++;
}
}
NSEndMapTableEnumeration(&me);
M_UNLOCK(myLock);
*count = pos;
}
#endif