+ if (open(tty, O_RDWR) < 0) {
+ int repcnt = 0;
+ do {
+ oerrno = errno;
+ if (repcnt % 10 == 0) {
+ f = open("/dev/console", O_WRONLY);
+ write(f, "init: ", 6);
+ write(f, tty, strlen(tty));
+ write(f, ": ", 2);
+ write(f, sys_errlist[oerrno],
+ strlen(sys_errlist[oerrno]));
+ write(f, "\n", 1);
+ close(f);
+ if ((f = open("/dev/tty", 2)) >= 0) {
+ ioctl(f, TIOCNOTTY, 0);
+ close(f);
+ }
+ }
+ repcnt++;
+ sleep(60);
+ } while (open(tty, O_RDWR) < 0);
+ exit(0); /* have wrong control tty, start over */
+ }