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
This commit is contained in:
parent
bec9e056eb
commit
6ee5808be7
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user