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) { 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to