From owner-svn-src-head@freebsd.org Sun Feb 25 20:15:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EB75CF24EB0; Sun, 25 Feb 2018 20:15:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 963996E7B9; Sun, 25 Feb 2018 20:15:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8775611A17; Sun, 25 Feb 2018 20:15:06 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w1PKF6Af010962; Sun, 25 Feb 2018 20:15:06 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w1PKF6Ea010961; Sun, 25 Feb 2018 20:15:06 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201802252015.w1PKF6Ea010961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 25 Feb 2018 20:15:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r329992 - head/libexec/getty X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/libexec/getty X-SVN-Commit-Revision: 329992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 25 Feb 2018 20:15:07 -0000 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) {