mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-28 21:40:30 +00:00
Fix some issues with select()
This commit is contained in:
parent
6918c3ffc2
commit
982dc4db87
4 changed files with 67 additions and 37 deletions
|
@ -43,14 +43,15 @@ const char *(DescribeFdSet)(char buf[N], ssize_t rc, int nfds, fd_set *fds) {
|
|||
for (int fd = 0; fd < nfds; fd += 64) {
|
||||
uint64_t w = fds->fds_bits[fd >> 6];
|
||||
while (w) {
|
||||
unsigned o = _bsr(w);
|
||||
w &= ~((uint64_t)1 << o);
|
||||
if (fd + o < nfds) {
|
||||
unsigned m = _bsr(w);
|
||||
w &= ~((uint64_t)1 << m);
|
||||
if (fd + m < nfds) {
|
||||
if (!gotsome) {
|
||||
gotsome = true;
|
||||
} else {
|
||||
append(", ");
|
||||
append("%d", fd);
|
||||
}
|
||||
append("%d", fd + m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue