X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=blobdiff_plain;f=src%2Fmisc%2Fpty.c;h=9e201ef3218b41bf8863ebabca04a845ddad70e0;hp=6ca33e3169b66fc1874343b21802bf17d788305e;hb=509b50eda8ea7d4a28f738e4cf8ea98d25959f00;hpb=750b738e53f799443fcfcd3a0751318c072a022f diff --git a/src/misc/pty.c b/src/misc/pty.c index 6ca33e31..9e201ef3 100644 --- a/src/misc/pty.c +++ b/src/misc/pty.c @@ -2,7 +2,9 @@ #include #include #include +#include #include "libc.h" +#include "syscall.h" int posix_openpt(int flags) { @@ -22,10 +24,11 @@ int unlockpt(int fd) int __ptsname_r(int fd, char *buf, size_t len) { - int pty; + int pty, err; if (!buf) len = 0; - return -( ioctl (fd, TIOCGPTN, &pty) < 0 - || snprintf(buf, len, "/dev/pts/%d", pty) >= len ); + if ((err = __syscall(SYS_ioctl, fd, TIOCGPTN, &pty))) return err; + if (snprintf(buf, len, "/dev/pts/%d", pty) >= len) return ERANGE; + return 0; } weak_alias(__ptsname_r, ptsname_r);