svn commit: r233945 - head/sbin/init
Ed Schouten
ed at FreeBSD.org
Fri Apr 6 13:06:02 UTC 2012
Author: ed
Date: Fri Apr 6 13:06:01 2012
New Revision: 233945
URL: http://svn.freebsd.org/changeset/base/233945
Log:
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
Modified:
head/sbin/init/init.c
Modified: head/sbin/init/init.c
==============================================================================
--- head/sbin/init/init.c Fri Apr 6 11:09:49 2012 (r233944)
+++ head/sbin/init/init.c Fri Apr 6 13:06:01 2012 (r233945)
@@ -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);
More information about the svn-src-all
mailing list