]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Use tcgetattr() instead of ioctl() for portability
authorJoel Rosdahl <joel@rosdahl.net>
Fri, 16 Jul 2010 15:45:54 +0000 (17:45 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 16 Jul 2010 15:45:54 +0000 (17:45 +0200)
configure.ac
test/framework.c

index cc6959cc982b99989aff41db09f3ef94b83ed53c..589a2a55e9a43c07de9df8721232eb54195d77df 100644 (file)
@@ -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)
index 5e01c02ef248ebe9e7d6892b952e47cb973d493d..e6fcc4822056393ea7da4501e4603c0bb2ece185 100644 (file)
 #include "ccache.h"
 #include "framework.h"
 #include <stdio.h>
-#if defined(HAVE_TERMIOS_H) && defined(HAVE_SYS_IOCTL_H)
+#if defined(HAVE_TERMIOS_H)
 #define USE_COLOR
 #include <termios.h>
-#include <sys/ioctl.h>
 #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;