FIX: tcgetattr for Linux in Ukbhit(), should return -1 if fail.

This commit is contained in:
iceman1001 2016-01-13 00:14:08 +01:00
parent f37fe8cb10
commit d04b71c168

View file

@ -21,14 +21,14 @@ int ukbhit(void)
int error;
static struct termios Otty, Ntty;
if ( tcgetattr( 0, &Otty) == -1) return false;
if ( tcgetattr( 0, &Otty) == -1) return -1;
Ntty = Otty;
Ntty.c_iflag = 0; /* input mode */
Ntty.c_oflag = 0; /* output mode */
Ntty.c_lflag &= ~ICANON; /* raw mode */
Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */
Ntty.c_cc[VTIME] = CTIME; /* minimum characters to wait for */
Ntty.c_iflag = 0; /* input mode */
Ntty.c_oflag = 0; /* output mode */
Ntty.c_lflag &= ~ICANON; /* raw mode */
Ntty.c_cc[VMIN] = CMIN; /* minimum time to wait */
Ntty.c_cc[VTIME] = CTIME; /* minimum characters to wait for */
if (0 == (error = tcsetattr(0, TCSANOW, &Ntty))) {
error += ioctl(0, FIONREAD, &cnt);