diff options
| author | Warner Losh <imp@FreeBSD.org> | 2004-10-01 06:20:23 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2004-10-01 06:20:23 +0000 |
| commit | dad92355ded2334738f5041dfb197e5cd876127f (patch) | |
| tree | f11d5ef191ac2fbeb89dd308192e72c473f88d38 /libexec | |
| parent | 16cc82ae6262b4fd93a612604883bc47db71fea4 (diff) | |
Notes
Diffstat (limited to 'libexec')
| -rw-r--r-- | libexec/getty/main.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/libexec/getty/main.c b/libexec/getty/main.c index 1555ae4efb43e..ceea009665648 100644 --- a/libexec/getty/main.c +++ b/libexec/getty/main.c @@ -427,37 +427,30 @@ main(int argc, char *argv[]) static int opentty(const char *tty, int flags) { - int i, j = 0; + int i; int failopenlogged = 0; - while (j < 10 && (i = open(tty, flags)) == -1) + while ((i = open(tty, flags)) == -1) { - if (((j % 10) == 0) && (errno != ENXIO || !failopenlogged)) { + if (!failopenlogged) { syslog(LOG_ERR, "open %s: %m", tty); failopenlogged = 1; } - j++; sleep(60); } - if (i == -1) { - syslog(LOG_ERR, "open %s: %m", tty); - return 0; - } - else { - if (login_tty(i) < 0) { - if (daemon(0,0) < 0) { - syslog(LOG_ERR,"daemon: %m"); - close(i); - return 0; - } - if (login_tty(i) < 0) { - syslog(LOG_ERR, "login_tty %s: %m", tty); - close(i); - return 0; - } + if (login_tty(i) < 0) { + if (daemon(0,0) < 0) { + syslog(LOG_ERR,"daemon: %m"); + close(i); + return 0; + } + if (login_tty(i) < 0) { + syslog(LOG_ERR, "login_tty %s: %m", tty); + close(i); + return 0; } - return 1; } + return 1; } static void |
