summaryrefslogtreecommitdiff
path: root/xinit.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-18 22:51:56 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2013-07-18 22:51:56 -0700
commit1dd71b4eae433896e41f8366f23b8269712b4cf3 (patch)
tree29be99469fe20d32746d9c4036f4a889773878ae /xinit.c
parent79fd43329e15432bab4f9f8856af385ac2ac0417 (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.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xinit.c b/xinit.c
index 5310101..873b4fa 100644
--- a/xinit.c
+++ b/xinit.c
@@ -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