assert(i >= 0 && i < n_waiters);
n_waiters--;
- memmove(&waiters[i], &waiters[i+1], n_waiters - i);
+ memmove(&waiters[i], &waiters[i+1],
+ (n_waiters - i) * sizeof(waiters[0]));
waiters = talloc_realloc(NULL, waiters, struct waiter, n_waiters);
}
static int n_pollfds;
int i, rc;
- if (n_waiters > n_pollfds) {
+ if (n_waiters != n_pollfds) {
pollfds = talloc_realloc(NULL, pollfds,
struct pollfd, n_waiters);
+ n_pollfds = n_waiters;
}
for (i = 0; i < n_waiters; i++) {