Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jul 1999 16:28:37 -0500 (CDT)
From:      Jonathan Lemon <jlemon@americantv.com>
To:        jwd@unx.sas.com, hackers@freebsd.org
Subject:   Re: Strange select/poll behaviour [EBADF inconsistancy]
Message-ID:  <199907082128.QAA00631@free.pcs>
In-Reply-To: <local.mail.freebsd-hackers/199907082010.QAA06869@bb01f39.unx.sas.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In article <local.mail.freebsd-hackers/199907082010.QAA06869@bb01f39.unx.sas.com> 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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199907082128.QAA00631>