summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/igt_aux.c12
-rw-r--r--lib/igt_core.c2
2 files changed, 11 insertions, 3 deletions
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 02f4defb..05528352 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -631,8 +631,10 @@ static void igt_interactive_info(const char *format, ...)
{
va_list args;
- if (!isatty(STDERR_FILENO) || __igt_plain_output)
+ if (!isatty(STDERR_FILENO) || __igt_plain_output) {
+ errno = 0; /* otherwise would be either ENOTTY or EBADF */
return;
+ }
if (igt_log_level > IGT_LOG_INFO)
return;
@@ -984,8 +986,10 @@ void igt_debug_wait_for_keypress(const char *var)
{
struct termios oldt, newt;
- if (!isatty(STDIN_FILENO))
+ if (!isatty(STDIN_FILENO)) {
+ errno = 0; /* otherwise would be either ENOTTY or EBADF */
return;
+ }
if (!igt_interactive_debug)
return;
@@ -1030,8 +1034,10 @@ void igt_debug_manual_check(const char *var, const char *expected)
struct termios oldt, newt;
char key;
- if (!isatty(STDIN_FILENO))
+ if (!isatty(STDIN_FILENO)) {
+ errno = 0; /* otherwise would be either ENOTTY or EBADF */
return;
+ }
if (!igt_interactive_debug)
return;
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6eb4798e..ae03e909 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -630,6 +630,8 @@ static void common_init_env(void)
if (!isatty(STDOUT_FILENO) || getenv("IGT_PLAIN_OUTPUT"))
__igt_plain_output = true;
+ errno = 0; /* otherwise may be either ENOTTY or EBADF because of isatty */
+
if (!__igt_plain_output)
setlocale(LC_ALL, "");