summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-05-29 17:43:46 +0000
committerEric Andersen <andersen@codepoet.org>2001-05-29 17:43:46 +0000
commitcaa78fb3fdbd4acd4016e10241dce815483e7d13 (patch)
treeafa0fc83cbd86cf1375e80b7c04c99493968d6e4
parent12eb7cae21a73ae13e30610e1d4286111e7a5835 (diff)
Sometimes (often) the kernel will return things other then -1.
Deal with it. -Erik
-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