Download raw body.
getty: check login_tty() failure
Hi,
I was reworking my X login environment and ran into a problem where
getty repeatedly reported:
/dev/console: Inappropriate ioctl for device
Tracing it showed that opening /dev/console succeeded, but login_tty()
failed at TIOCSCTTY with EPERM. Getty ignores that return value and goes
on to call tcgetattr() on its inherited stdin, producing the misleading
ENOTTY error.
This checks the return from login_tty() and exits. It does not address
the underlying console/session conflict but that is probably just
something I broke that exposed this defect.
Ted
--- libexec/getty/main.c
+++ libexec/getty/main.c
@@ -247,7 +247,10 @@
repcnt++;
sleep(60);
}
- login_tty(i);
+ if (login_tty(i) == -1) {
+ syslog(LOG_ERR, "%s: login_tty: %m", ttyn);
+ exit(1);
+ }
}
}
getty: check login_tty() failure