mirror of git://git.musl-libc.org/musl
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
|
@ -26,7 +26,7 @@ int __ptsname_r(int fd, char *buf, size_t len)
|
||||||
{
|
{
|
||||||
int pty, err;
|
int pty, err;
|
||||||
if (!buf) len = 0;
|
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;
|
if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue