summaryrefslogtreecommitdiff
path: root/lib/igt_aux.c
diff options
context:
space:
mode:
authorArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-04-09 17:21:41 +0300
committerArkadiusz Hiler <arkadiusz.hiler@intel.com>2019-04-10 18:18:29 +0300
commita558c2e2405473f4157ca71638e5a111ebfa80d1 (patch)
tree0d97e904892f1504903525df6dcd57543a93ac16 /lib/igt_aux.c
parent64d0ff7247497ae6d726e4535fe74d4bb6ae914a (diff)
lib: Reset errno to 0 after isatty
Since igt_assert family of functions logs last errno we get a lot of those: "Last errno: 25, Inappropriate ioctl for device" isatty() seems to be the biggest offender in that area, so this patch should limit amount of confusing messages significantly. Cc: Martin Peres <martin.peres@linux.intel.com> Cc: Petri Latvala <petri.latvala@intel.com> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com> Reviewed-by: Petri Latvala <petri.latvala@intel.com>
Diffstat (limited to 'lib/igt_aux.c')
-rw-r--r--lib/igt_aux.c12
1 files changed, 9 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;