From 71c1d7c5404c09e6904f513c6ffd407b7a1e5cc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Stenberg?= Date: Tue, 19 May 2020 15:57:35 +0200 Subject: [PATCH] Show error when failing to open a tty --- src/tty.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/tty.c b/src/tty.c index bee6f9f..503b11b 100644 --- a/src/tty.c +++ b/src/tty.c @@ -460,6 +460,7 @@ void tty_wait_for_device(void) struct timeval tv; static char input_char, previous_char = 0; static bool first = true; + static int last_errno = 0; /* Loop until device pops up */ while (true) @@ -506,8 +507,15 @@ void tty_wait_for_device(void) } /* Test for accessible device file */ - if (access(option.tty_device, R_OK) == 0) + int rc = access(option.tty_device, R_OK); + if (rc == 0) { + last_errno = 0; return; + } + else if (last_errno != errno) { + tio_printf("%s: %s. Waiting...", option.tty_device, strerror(errno)); + last_errno = errno; + } } }