diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-10-22 07:13:57 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-10-22 07:13:57 +0000 |
commit | 4c593181389b86bc184bdbf2b09dfdadd57b9c71 (patch) | |
tree | 3268b407a671fe488e3fd1432c770c737b1d2b88 /libc/stdlib/ptsname.c | |
parent | bf391f86d04e5aa4166ad3f764c002488521882d (diff) |
When UNIX98PTY_ONLY was false, but Unix 98 ptys were in fact working and
functional, everything would succeed but then we would return a failure due to
a silly logic bug. This patch fixes it so things will work correctly
regardless of the UNIX98PTY_ONLY setting.
-Erik
Diffstat (limited to 'libc/stdlib/ptsname.c')
-rw-r--r-- | libc/stdlib/ptsname.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c index 74f3e87d9..7f9b04e93 100644 --- a/libc/stdlib/ptsname.c +++ b/libc/stdlib/ptsname.c @@ -102,6 +102,15 @@ int ptsname_r (int fd, char *buf, size_t buflen) strcpy (buf, devpts); strcat (buf, p); + /* Note: Don't bother with stat on the slave name and checking the + driver's major device number - the ioctl above succeeded so + we know the fd was a Unix'98 master and the /dev/pts/ prefix + is set by definition. If the name isn't really a slave PTY, + the system is misconfigured anyway - something else will fail + later. + */ + errno = save_errno; + return 0; } #endif #if defined UNIX98PTY_ONLY @@ -111,13 +120,6 @@ int ptsname_r (int fd, char *buf, size_t buflen) errno = ENOTTY; return ENOTTY; } - /* Note: Don't bother with stat on the slave name and checking the - driver's major device number - the ioctl above succeeded so - we know the fd was a Unix'98 master and the /dev/pts/ prefix - is set by definition. If the name isn't really a slave PTY, - the system is misconfigured anyway - something else will fail - later. - */ #else # if !defined TIOCGPTN else if (errno == EINVAL) |