aports/main/musl/isatty-glibc-align.patch

15 lines
456 B
Diff

diff --git a/src/unistd/isatty.c b/src/unistd/isatty.c
index 75a9c186..21222eda 100644
--- a/src/unistd/isatty.c
+++ b/src/unistd/isatty.c
@@ -6,8 +6,6 @@
int isatty(int fd)
{
struct winsize wsz;
- unsigned long r = syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz);
- if (r == 0) return 1;
- if (errno != EBADF) errno = ENOTTY;
- return 0;
+ /* +1 converts from error status (0/-1) to boolean (1/0) */
+ return syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz) + 1;
}