Prevent getty(8) from looping indefinitely if the device node doesn't
exist. This behaviour makes no sense for eg USB serial adapters, or USB device-side serial templates. This mostly reverts to pre-r135941 behaviour. Reviewed by: imp@ Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14198
This commit is contained in:
parent
615395d985
commit
170430d505
@ -427,15 +427,17 @@ main(int argc, char *argv[])
|
||||
static int
|
||||
opentty(const char *tty, int flags)
|
||||
{
|
||||
int i;
|
||||
int failopenlogged = 0;
|
||||
int failopenlogged = 0, i, saved_errno;
|
||||
|
||||
while ((i = open(tty, flags)) == -1)
|
||||
{
|
||||
saved_errno = errno;
|
||||
if (!failopenlogged) {
|
||||
syslog(LOG_ERR, "open %s: %m", tty);
|
||||
failopenlogged = 1;
|
||||
}
|
||||
if (saved_errno == ENOENT)
|
||||
return 0;
|
||||
sleep(60);
|
||||
}
|
||||
if (login_tty(i) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user