fix negated error codes from ptsname_r

the incorrect error codes also made their way into errno when
__ptsname_r was called by plain ptsname, which reports errors via
errno rather than a return value.
This commit is contained in:
Rich Felker 2014-03-17 00:25:23 -04:00
parent 611eabd489
commit 6619317164
1 changed files with 1 additions and 1 deletions

View File

@ -26,7 +26,7 @@ int __ptsname_r(int fd, char *buf, size_t len)
{
int pty, err;
if (!buf) len = 0;
if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return err;
if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return -err;
if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE;
return 0;
}