提交 66193171 编写于 作者: R Rich Felker

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.
上级 611eabd4
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册