From owner-freebsd-hackers Thu Jul 8 14:28:54 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from sumatra.americantv.com (sumatra.americantv.com [208.139.222.227]) by hub.freebsd.org (Postfix) with ESMTP id F0D4814E4C for ; Thu, 8 Jul 1999 14:28:41 -0700 (PDT) (envelope-from jlemon@americantv.com) Received: from right.PCS (right.PCS [148.105.10.31]) by sumatra.americantv.com (8.8.5/8.8.5) with ESMTP id QAA17507; Thu, 8 Jul 1999 16:28:38 -0500 (CDT) Received: from free.pcs (free.PCS [148.105.10.51]) by right.PCS (8.6.13/8.6.4) with ESMTP id QAA25077; Thu, 8 Jul 1999 16:28:37 -0500 Received: (from jlemon@localhost) by free.pcs (8.8.6/8.8.5) id QAA00631; Thu, 8 Jul 1999 16:28:37 -0500 (CDT) Date: Thu, 8 Jul 1999 16:28:37 -0500 (CDT) From: Jonathan Lemon Message-Id: <199907082128.QAA00631@free.pcs> To: jwd@unx.sas.com, hackers@freebsd.org Subject: Re: Strange select/poll behaviour [EBADF inconsistancy] X-Newsgroups: local.mail.freebsd-hackers In-Reply-To: Organization: Architecture and Operating System Fanatics Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In article you write: >Hi, > > The following program returns an inconsistant rc/errno value. >Setting a bit corresponding to filedescriptor which is not open >is only found when it is less than 20. ie: This is because initially, only 20 descriptors are allocated, and the system is quietly ignoring any descriptors over the allocated amount: if (uap->nd > p->p_fd->fd_nfiles) uap->nd = p->p_fd->fd_nfiles; /* forgiving; slightly wrong */ This should be: if (uap->nd > p->p_fd->fd_nfiles) return (EBADF); -- Jonathan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message