In article 
<local.mail.freebsd-hackers/199907082010.qaa06...@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 majord...@freebsd.org
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to