Changeset 3383


Ignore:
Timestamp:
Jun 10, 2007, 12:24:01 PM (18 years ago)
Author:
bird
Message:

Calculate the correct fd_set size and max handle count for the BSD44 version. Fixes #173.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libc-0.6/src/emx/src/lib/sys/tcpipver.c

    r3382 r3383  
    933933    *pcFDs = iMax + 1;
    934934#else
    935     for (cbRet = sizeof(u_short), i = 0; i < c; i++)
     935    for (i = cbRet = 0; i < c; i++)
    936936        if (FD_ISSET(i, pFrom))
    937937            cbRet++;
    938     *pcFDs = c;
     938    if (*pcFDs < cbRet + 1)
     939        *pcFDs = cbRet + 1;
     940    cbRet *= sizeof(int);
     941    cbRet += offsetof(my_fd_set, fd_array);
    939942#endif
    940943    if (cbRet < sizeof(struct my_fd_set))
  • trunk/libc/src/kNIX/os2/tcpipver.c

    r3382 r3383  
    946946    *pcFDs = iMax + 1;
    947947#else
    948     for (cbRet = sizeof(u_short), i = 0; i < c; i++)
     948    for (i = cbRet = 0; i < c; i++)
    949949        if (FD_ISSET(i, pFrom))
    950950            cbRet++;
    951     *pcFDs = c;
     951    if (*pcFDs < cbRet + 1)
     952        *pcFDs = cbRet + 1;
     953    cbRet *= sizeof(int);
     954    cbRet += offsetof(my_fd_set, fd_array);
    952955#endif
    953956    if (cbRet < sizeof(struct my_fd_set))
Note: See TracChangeset for help on using the changeset viewer.