diff options
author | ed <ed@FreeBSD.org> | 2012-04-06 13:06:01 +0000 |
---|---|---|
committer | ed <ed@FreeBSD.org> | 2012-04-06 13:06:01 +0000 |
commit | a1c22adf5f7130c9e6f3bd6d23bcec9542575a27 (patch) | |
tree | 6e544eff6970eb129ba0d4a7afccdf652ea70163 | |
parent | 3e6288731d32f3c79ae3b8f659e8f36c111cb518 (diff) | |
download | FreeBSD-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
-rw-r--r-- | sbin/init/init.c | 6 |
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); |