diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-18 22:51:56 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2013-07-18 22:51:56 -0700 |
commit | 1dd71b4eae433896e41f8366f23b8269712b4cf3 (patch) | |
tree | 29be99469fe20d32746d9c4036f4a889773878ae /xinit.c | |
parent | 79fd43329e15432bab4f9f8856af385ac2ac0417 (diff) |
If we have to forcibly kill the Xserver on Solaris, reset kbd_mode
If the Xserver hangs when xinit is waiting for it to die, and xinit
sends a kill -9 to it, then it will leave the keyboard in a state that
can't be used on the text console, so fix it up ourselves.
Upstreaming from Solaris, where it was originally implemented to fix
Sun bug 4221128 “If Xserver is slow to exit, xinit does "kill -9" and
kbd_mode -a is required”
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'xinit.c')
-rw-r--r-- | xinit.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -627,6 +627,26 @@ shutdown(void) if (processTimeout(3, "server to die")) Fatalx("X server refuses to die"); +#ifdef __sun + else { + /* Restore keyboard mode. */ + serverpid = fork(); + switch (serverpid) { + case 0: + execlp ("kbd_mode", "kbd_mode", "-a", NULL); + Fatal("Unable to run program \"%s\"", "kbd_mode"); + break; + + case 1: + Error("fork failed"); + break; + + default: + fprintf (stderr, "\r\nRestoring keyboard mode\r\n"); + processTimeout(1, "kbd_mode"); + } + } +#endif } static void |