SCP: Use O_NDELAY when putting fd 0 into non blocking mode on Linux

This commit is contained in:
Mark Pizzolato 2018-09-02 07:30:02 -07:00
parent ed081894f8
commit 7f9e60de58

View file

@ -3955,7 +3955,15 @@ static t_stat sim_os_ttinit (void)
sim_debug (DBG_TRC, &sim_con_telnet, "sim_os_ttinit()\n");
cmdfl = fcntl (fileno (stdin), F_GETFL, 0); /* get old flags and status */
runfl = cmdfl | FNDELAY;
runfl = cmdfl;
/*
* make sure systems with broken termios (that don't honor
* VMIN=0 and VTIME=0) actually implement non blocking reads.
* This will have no negative effect on other systems since
* this is turned on and off depending on whether simulation
* is running or not.
*/
runfl = cmdfl | O_NDELAY;
if (!isatty (fileno (stdin))) /* skip if !tty */
return SCPE_OK;
if (tcgetattr (0, &cmdtty) < 0) /* get old flags */