Setup a minimal sane TTY when asking for passphrases

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët 2020-04-26 11:00:07 +00:00
parent 961608c6d7
commit a9d18d8993

View file

@ -129,6 +129,9 @@ s_input(unsigned char *buf, size_t size, const char *prompt)
struct termios new = old;
new.c_lflag &= ~(ECHO | ECHONL);
new.c_lflag |= ICANON;
new.c_iflag &= ~(INLCR | IGNCR);
new.c_iflag |= ICRNL;
tcsetattr(fd, TCSAFLUSH, &new);
ssize_t ret = read(fd, buf, size - 1);