svn commit: r184300 - in stable/7/lib: libc/stdlib libutil

John Baldwin jhb at freebsd.org
Mon Oct 27 12:21:38 PDT 2008


On Sunday 26 October 2008 05:55:19 pm Ed Schouten wrote:
> Author: ed
> Date: Sun Oct 26 21:55:19 2008
> New Revision: 184300
> URL: http://svn.freebsd.org/changeset/base/184300
> 
> Log:
>   MFC r183565:
>   
>     Small cleanups to openpty().
>   
>     - Pass O_NOCTTY to posix_openpt(2). This makes the implementation work
>       consistently on implementations that make the PTY the controlling TTY
>       by default.
>   
>     - Call unlockpt() before opening the slave device. POSIX mentions that
>       de slave device should only be opened after grantpt() and unlockpt()
>       have been called.
>   
>     - Replace some redundant code by a label.
>   
>   As a safety net, add a call to revoke() to unlockpt(). All applications
>   out there use openpty(), explicitly call revoke() or implement their own
>   PTY allocation routines. Adding the call to unlockpt() won't hurt, but
>   will prevent foot-shooting.
>   
>   Reviewed by:	jhb, kib
>   Approved by:	re

I would perhaps add a note that the duplicate revoke() in openpty() is only to 
support legacy libc's with broken unlockpt() routines.  We could maybe remove 
the revoke()/ptsname() from openpty() on 8.x though as all 8.x machines 
should have a working unlockpt().

-- 
John Baldwin


More information about the svn-src-all mailing list