do not try to allocate 0 bytes
This commit is contained in:
parent
f369f47c26
commit
8192548ef7
|
@ -211,13 +211,16 @@ fail:
|
||||||
int fdset_close_others(FDSet *fds) {
|
int fdset_close_others(FDSet *fds) {
|
||||||
void *e;
|
void *e;
|
||||||
Iterator i;
|
Iterator i;
|
||||||
int *a;
|
int *a = NULL;
|
||||||
size_t j = 0, m;
|
size_t j = 0, m;
|
||||||
|
|
||||||
m = fdset_size(fds);
|
m = fdset_size(fds);
|
||||||
a = newa(int, m);
|
|
||||||
SET_FOREACH(e, MAKE_SET(fds), i)
|
if (m > 0) {
|
||||||
a[j++] = PTR_TO_FD(e);
|
a = newa(int, m);
|
||||||
|
SET_FOREACH(e, MAKE_SET(fds), i)
|
||||||
|
a[j++] = PTR_TO_FD(e);
|
||||||
|
}
|
||||||
|
|
||||||
assert(j == m);
|
assert(j == m);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue