summaryrefslogtreecommitdiffstats
path: root/sbin/init
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2012-04-06 13:06:01 +0000
committered <ed@FreeBSD.org>2012-04-06 13:06:01 +0000
commita1c22adf5f7130c9e6f3bd6d23bcec9542575a27 (patch)
tree6e544eff6970eb129ba0d4a7afccdf652ea70163 /sbin/init
parent3e6288731d32f3c79ae3b8f659e8f36c111cb518 (diff)
downloadFreeBSD-src-a1c22adf5f7130c9e6f3bd6d23bcec9542575a27.zip
FreeBSD-src-a1c22adf5f7130c9e6f3bd6d23bcec9542575a27.tar.gz
Properly clear the O_NONBLOCK flag after opening the TTY.
Though we should open the TTY with O_NONBLOCK to prevent rc(8) execution from potentially stalling, we must not forget to clear the flag later on, to prevent read(2) calls from failing later on. This prevented the shell pathname prompt from working properly. Reported by: kib
Diffstat (limited to 'sbin/init')
-rw-r--r--sbin/init/init.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sbin/init/init.c b/sbin/init/init.c
index a24371c..8fd93bd 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -572,9 +572,13 @@ open_console(void)
{
int fd;
- /* Try to open /dev/console. */
+ /*
+ * Try to open /dev/console. Open the device with O_NONBLOCK to
+ * prevent potential blocking on a carrier.
+ */
revoke(_PATH_CONSOLE);
if ((fd = open(_PATH_CONSOLE, O_RDWR | O_NONBLOCK)) != -1) {
+ (void)fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK);
if (login_tty(fd) == 0)
return;
close(fd);
OpenPOWER on IntegriCloud