aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-03-17 00:25:23 -0400
committerRich Felker <dalias@aerifal.cx>2014-03-17 00:25:23 -0400
commit66193171648ea34ad5acf08fcca48c8f0a850030 (patch)
tree62a0c17de7e0a3f5ffefe8c6bfe07bee8db7d228
parent611eabd489ce4eab3a70c410f363774bbcbbd3e9 (diff)
downloadmusl-66193171648ea34ad5acf08fcca48c8f0a850030.zip
musl-66193171648ea34ad5acf08fcca48c8f0a850030.tar.gz
musl-66193171648ea34ad5acf08fcca48c8f0a850030.tar.bz2
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.
-rw-r--r--src/misc/pty.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/misc/pty.c b/src/misc/pty.c
index 9e201ef..b395d2c 100644
--- a/src/misc/pty.c
+++ b/src/misc/pty.c
@@ -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;
}