cvs commit: src/lib/libutil pty.c

Ed Schouten ed at FreeBSD.org
Fri Oct 3 09:43:06 UTC 2008


ed          2008-10-03 09:42:50 UTC

  FreeBSD src repository

  Modified files:
    lib/libutil          pty.c 
  Log:
  SVN rev 183565 on 2008-10-03 09:42:50Z by ed
  
  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.
  
  In theory we could remove a lot of code from openpty() on FreeBSD
  -CURRENT, because grantpt(), unlockpt() and revoke() are not needed in
  our implementation. We'd better keep them there. This makes the code
  still work with older FreeBSD releases and even makes it work on other
  non-BSD operating systems.
  
  I've compiled openpty() on Linux. You only need to remove the revoke()
  call, because revoke() on Linux always returns -1. Apart from that, it
  seems to work like it should.
  
  Reviewed by:    jhb
  
  Revision  Changes    Path
  1.23      +15 -23    src/lib/libutil/pty.c


More information about the cvs-all mailing list