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:
parent
611eabd489
commit
6619317164
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue