Date: Wed, 22 Sep 2010 19:05:54 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r213008 - head/sbin/hastd Message-ID: <201009221905.o8MJ5sog039778@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Wed Sep 22 19:05:54 2010 New Revision: 213008 URL: http://svn.freebsd.org/changeset/base/213008 Log: Assert that descriptor numbers are sane. MFC after: 3 days Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Wed Sep 22 19:03:11 2010 (r213007) +++ head/sbin/hastd/hastd.c Wed Sep 22 19:05:54 2010 (r213008) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009221905.o8MJ5sog039778>