fix possible isatty false positives and unwanted device state changes
[oweals/musl.git] / src / unistd / isatty.c
1 #include <unistd.h>
2 #include <sys/ioctl.h>
3 #include "syscall.h"
4
5 int isatty(int fd)
6 {
7         struct winsize wsz;
8         return !__syscall(SYS_ioctl, fd, TIOCGWINSZ, &wsz);
9 }