From: Joel Rosdahl Date: Fri, 16 Jul 2010 15:45:54 +0000 (+0200) Subject: Use tcgetattr() instead of ioctl() for portability X-Git-Tag: v3.1~174 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=977253bc89f187cdda4ee3a0c5cdb27777d98b5f;p=thirdparty%2Fccache.git Use tcgetattr() instead of ioctl() for portability --- diff --git a/configure.ac b/configure.ac index cc6959cc9..589a2a55e 100644 --- a/configure.ac +++ b/configure.ac @@ -172,7 +172,7 @@ AC_HEADER_TIME AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(ctype.h pwd.h stdlib.h string.h strings.h sys/time.h sys/mman.h) -AC_CHECK_HEADERS(sys/ioctl.h termios.h) +AC_CHECK_HEADERS(termios.h) AC_CHECK_FUNCS(asprintf) AC_CHECK_FUNCS(gethostname) diff --git a/test/framework.c b/test/framework.c index 5e01c02ef..e6fcc4822 100644 --- a/test/framework.c +++ b/test/framework.c @@ -19,10 +19,9 @@ #include "ccache.h" #include "framework.h" #include -#if defined(HAVE_TERMIOS_H) && defined(HAVE_SYS_IOCTL_H) +#if defined(HAVE_TERMIOS_H) #define USE_COLOR #include -#include #endif static unsigned passed_asserts; @@ -48,7 +47,7 @@ is_tty(int fd) { #ifdef USE_COLOR struct termios t; - return ioctl(fd, TCGETS, &t) == 0; + return tcgetattr(fd, &t) == 0; #else (void)fd; return 0;