summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-06-19 10:53:08 -0400
committerRay Strode <rstrode@redhat.com>2008-06-19 10:53:08 -0400
commite77d7112d8e7a6d769ef885e0fa5c7c4257d5da0 (patch)
tree17005b3b405cc06b5180a202dfbf8f410d91be76
parent83a23fc4565cf06c62fc1abe7762084e1eaa3f66 (diff)
downloadplymouth-e77d7112d8e7a6d769ef885e0fa5c7c4257d5da0.tar.gz
plymouth-e77d7112d8e7a6d769ef885e0fa5c7c4257d5da0.tar.xz
plymouth-e77d7112d8e7a6d769ef885e0fa5c7c4257d5da0.zip
return to text mode on crash
-rw-r--r--src/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index b586f45..86597cd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -29,8 +29,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <sysexits.h>
+#include <sys/ioctl.h>
#include <unistd.h>
+#include <linux/kd.h>
+
#include "ply-answer.h"
#include "ply-boot-server.h"
#include "ply-boot-splash.h"
@@ -385,6 +388,18 @@ initialize_environment (state_t *state)
return true;
}
+static void
+on_crash (int signal)
+{
+ int fd;
+
+ fd = open ("/dev/tty7", O_RDWR | O_NOCTTY);
+
+ ioctl (fd, KDSETMODE, KD_TEXT);
+
+ close (fd);
+}
+
int
main (int argc,
char **argv)
@@ -423,6 +438,9 @@ main (int argc,
return EX_UNAVAILABLE;
}
+ signal (SIGABRT, on_crash);
+ signal (SIGSEGV, on_crash);
+
state.loop = ply_event_loop_new ();
/* before do anything we need to make sure we have a working