diff options
author | pjd <pjd@FreeBSD.org> | 2010-09-22 19:05:54 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2010-09-22 19:05:54 +0000 |
commit | 2eee4ca70d37cd47c54a9641d8bd574f33579200 (patch) | |
tree | ebc13a7ab1b02c0fb147340c5357c29079c5446f /sbin | |
parent | 9433a082e8ce9d04d47ef10efdf954103b527d01 (diff) | |
download | FreeBSD-src-2eee4ca70d37cd47c54a9641d8bd574f33579200.zip FreeBSD-src-2eee4ca70d37cd47c54a9641d8bd574f33579200.tar.gz |
Assert that descriptor numbers are sane.
MFC after: 3 days
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/hastd/hastd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c index af46882..651730d 100644 --- a/sbin/hastd/hastd.c +++ b/sbin/hastd/hastd.c @@ -650,18 +650,22 @@ main_loop(void) /* Setup descriptors for select(2). */ FD_ZERO(&rfds); maxfd = fd = proto_descriptor(cfg->hc_controlconn); + assert(fd >= 0); FD_SET(fd, &rfds); fd = proto_descriptor(cfg->hc_listenconn); + assert(fd >= 0); FD_SET(fd, &rfds); maxfd = fd > maxfd ? fd : maxfd; TAILQ_FOREACH(res, &cfg->hc_resources, hr_next) { if (res->hr_event == NULL) continue; fd = proto_descriptor(res->hr_event); + assert(fd >= 0); FD_SET(fd, &rfds); maxfd = fd > maxfd ? fd : maxfd; } + assert(maxfd + 1 <= (int)FD_SETSIZE); ret = select(maxfd + 1, &rfds, NULL, NULL, &timeout); if (ret == 0) hook_check(false); |