init: set default termios on every username prompt
Before if e.g. Shell crashed init would have broken termios
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <termios.h>
|
||||||
|
|
||||||
void initialize_stdio()
|
void initialize_stdio()
|
||||||
{
|
{
|
||||||
@@ -26,8 +27,13 @@ int main()
|
|||||||
|
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
|
termios termios;
|
||||||
|
tcgetattr(STDIN_FILENO, &termios);
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
|
tcsetattr(STDIN_FILENO, TCSANOW, &termios);
|
||||||
|
|
||||||
char name_buffer[128];
|
char name_buffer[128];
|
||||||
|
|
||||||
while (!first)
|
while (!first)
|
||||||
|
|||||||
Reference in New Issue
Block a user