Date: Sun, 25 Feb 2018 20:15:06 +0000 (UTC) From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329992 - head/libexec/getty Message-ID: <201802252015.w1PKF6Ea010961@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trasz Date: Sun Feb 25 20:15:06 2018 New Revision: 329992 URL: https://svnweb.freebsd.org/changeset/base/329992 Log: 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 Modified: head/libexec/getty/main.c Modified: head/libexec/getty/main.c ============================================================================== --- head/libexec/getty/main.c Sun Feb 25 19:43:00 2018 (r329991) +++ head/libexec/getty/main.c Sun Feb 25 20:15:06 2018 (r329992) @@ -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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802252015.w1PKF6Ea010961>