From caa78fb3fdbd4acd4016e10241dce815483e7d13 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Tue, 29 May 2001 17:43:46 +0000 Subject: Sometimes (often) the kernel will return things other then -1. Deal with it. -Erik --- libc/termios/termios.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libc/termios') 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 -- cgit v1.2.3