pty: set VERASE character to backspace during setup
Some crazy guy decided to set VERASE to DEL by default in the kernel. So when starting an application which does not initialize the terminal on startup, they may not notice that we actually send BACKSPACE as erase-character (like /bin/login). Therefore, initialize VERASE to 010 so everyone is happy. Thanks to Etam for reporting this! Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
e1f04b12ab
commit
abde919bbd
16
src/pty.c
16
src/pty.c
@ -184,6 +184,7 @@ static void setup_child(int master, struct winsize *ws)
|
||||
pid_t pid;
|
||||
char slave_name[128];
|
||||
int slave = -1;
|
||||
struct termios attr;
|
||||
|
||||
/* The child should not inherit our signal mask. */
|
||||
sigemptyset(&sigset);
|
||||
@ -223,6 +224,21 @@ static void setup_child(int master, struct winsize *ws)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* get terminal attributes */
|
||||
if (tcgetattr(slave, &attr) < 0) {
|
||||
log_err("cannot get terminal attributes: %m");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
/* erase character should be normal backspace */
|
||||
attr.c_cc[VERASE] = 010;
|
||||
|
||||
/* set changed terminal attributes */
|
||||
if (tcsetattr(slave, TCSANOW, &attr) < 0) {
|
||||
log_warn("cannot set terminal attributes: %m");
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
if (ws) {
|
||||
ret = ioctl(slave, TIOCSWINSZ, ws);
|
||||
if (ret)
|
||||
|
Loading…
x
Reference in New Issue
Block a user