summaryrefslogtreecommitdiff
path: root/libc/termios
diff options
context:
space:
mode:
Diffstat (limited to 'libc/termios')
-rw-r--r--libc/termios/termios.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libc/termios/termios.c b/libc/termios/termios.c
index d6cd124d1..e0c3743d0 100644
--- a/libc/termios/termios.c
+++ b/libc/termios/termios.c
@@ -35,14 +35,13 @@
int isatty(int fd)
{
- struct __kernel_termios k_term;
+ struct __kernel_termios k_term;
- /*
- * When ioctl returns -1 we want to return 0 and
- * when ioctl returns 0 we want to return 1.
- * Incrementing is cheaper (size & speed) than a test.
- */
- return ioctl(fd, TCGETS, &k_term) + 1;
+ /*
+ * When ioctl returns -1 we want to return 0 and
+ * when ioctl returns 0 we want to return 1.
+ */
+ return (ioctl(fd, TCGETS, &k_term)==0)? 1 : 0;
}
#endif