On Thursday 09 November 2006 14:33, Ed Schouten wrote: > * Ed Schouten <[EMAIL PROTECTED]> wrote: > > The patch below prevents this by performing this check by do_dup(). It > > will prevent fcntl() from PROC_LOCK()'ing twice. It also fixes the > > return value of fcntl(). The manual page states that it should return > > EMFILE when it exceeds its limit, though the actual code sets EINVAL. > > Woops - It looks like I wasn't awake when I was reading the fcntl() > manual page. fcntl() should return EINVAL when the minimum value is > higher than the limit and EMFILE when it can't find a free descriptor in > the range from the minimum value to the maximum. dup() generalizes this > to EMFILE. It cannot return EINVAL. > > I decided to change the patch that do_dup() can return EINVAL for the > fcntl() scenario and that the dup()/dup2() system calls readjust the > errno right before returning. Please use the patch below.
I actually the resulting changes obfuscate the code more than the current code, so I'd prefer to just leave it as it is. -- John Baldwin _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"