diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-12 21:40:43 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-12 21:40:43 +0200 |
commit | 3fe5e5d476f6a653e303913aff6c438807b80b3b (patch) | |
tree | 9d25f90c3ff9b9af6081160a1edd803291cde235 /src/util.c | |
parent | 7bc0351dd8bdd5045101616d304a3f16ecb91e5a (diff) |
util: reset terminal even harder
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index b5513dd74c..e5d845609d 100644 --- a/src/util.c +++ b/src/util.c @@ -47,6 +47,7 @@ #include <sys/utsname.h> #include <pwd.h> #include <netinet/ip.h> +#include <linux/kd.h> #include "macro.h" #include "util.h" @@ -1844,10 +1845,22 @@ int ask(char *ret, const char *replies, const char *text, ...) { int reset_terminal(int fd) { struct termios termios; int r = 0; + long arg; + + /* Set terminal to some sane defaults */ assert(fd >= 0); - /* Set terminal to some sane defaults */ + /* First, unlock termios */ + zero(termios); + ioctl(fd, TIOCSLCKTRMIOS, &termios); + + /* Disable exclusive mode, just in case */ + ioctl(fd, TIOCNXCL); + + /* Enable console unicode mode */ + arg = K_UNICODE; + ioctl(fd, KDSKBMODE, &arg); if (tcgetattr(fd, &termios) < 0) { r = -errno; |