mirror of
https://github.com/tio/tio.git
synced 2026-05-01 23:07:58 +02:00
Show error when failing to open a tty
This commit is contained in:
parent
39a8f63640
commit
71c1d7c540
1 changed files with 9 additions and 1 deletions
10
src/tty.c
10
src/tty.c
|
|
@ -460,6 +460,7 @@ void tty_wait_for_device(void)
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
static char input_char, previous_char = 0;
|
static char input_char, previous_char = 0;
|
||||||
static bool first = true;
|
static bool first = true;
|
||||||
|
static int last_errno = 0;
|
||||||
|
|
||||||
/* Loop until device pops up */
|
/* Loop until device pops up */
|
||||||
while (true)
|
while (true)
|
||||||
|
|
@ -506,8 +507,15 @@ void tty_wait_for_device(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test for accessible device file */
|
/* 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;
|
return;
|
||||||
|
}
|
||||||
|
else if (last_errno != errno) {
|
||||||
|
tio_printf("%s: %s. Waiting...", option.tty_device, strerror(errno));
|
||||||
|
last_errno = errno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue