NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/56779: RAW mode on the TTY always returns EOF (-1)



The following reply was made to PR kern/56779; it has been noted by GNATS.

From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/56779: RAW mode on the TTY always returns EOF (-1)
Date: Tue, 5 Apr 2022 07:35:51 -0000 (UTC)

 mac%culver.net@localhost writes:
 
 >    // Back up current TTY settings
 >    tcgetattr(STDIN_FILENO, &tty_opts_backup);
 
 >    // Change TTY settings to raw mode
 >    cfmakeraw(&tty_opts_raw);
 >    tty_opts_raw.c_ispeed = tty_opts_backup.c_ispeed;
 >    tty_opts_raw.c_ospeed = tty_opts_backup.c_ospeed;
 >    tcsetattr(STDIN_FILENO, TCSANOW, &tty_opts_raw);
 
 Try:
 
 tty_opts_raw = tty_opts_backup;
 cfmakeraw(&tty_opts_raw);
 tcsetattr(STDIN_FILENO, TCSANOW, &tty_opts_raw);
 
 cfmakeraw changes the configuration in a termios structure,
 but it doesn't magically initialize values. Your code
 just uses random stack content with unpredictable results.
 


Home | Main Index | Thread Index | Old Index