diff options
Diffstat (limited to 'libc')
-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) |