From owner-svn-src-all@FreeBSD.ORG Fri Apr 6 13:06:02 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1226E1065675; Fri, 6 Apr 2012 13:06:02 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F14D48FC0A; Fri, 6 Apr 2012 13:06:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q36D61cG009784; Fri, 6 Apr 2012 13:06:01 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q36D611i009782; Fri, 6 Apr 2012 13:06:01 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <201204061306.q36D611i009782@svn.freebsd.org> From: Ed Schouten Date: Fri, 6 Apr 2012 13:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233945 - head/sbin/init X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Apr 2012 13:06:02 -0000 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);