diff options
author | Rich Felker <dalias@aerifal.cx> | 2006-10-05 20:26:44 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2006-10-05 20:26:44 +0000 |
commit | 98f8b3709355fd0f3e05952cee3ec54ec2d0b5ba (patch) | |
tree | 4cd8a7e80d49be4c6db1e53b0f354ae669c5996c /fbcon.c | |
parent | 67b4f15dbf571af8db984b9abcff1e144b2a45d9 (diff) |
exit gracefully on fatal signals (with nongraceful code...signals suck!)
Diffstat (limited to 'fbcon.c')
-rw-r--r-- | fbcon.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -61,6 +61,15 @@ static int get_fb_size(struct uudisp *d) return 0; } +static struct uudisp *display; + +static void fatalsignal(int sig) +{ + uudisp_close(display); + signal(sig, SIG_DFL); + raise(sig); +} + static void dummy(int x) { } @@ -185,6 +194,14 @@ int uudisp_open(struct uudisp *d) signal(SIGTTIN, SIG_IGN); signal(SIGTTOU, SIG_IGN); + display = d; + signal(SIGINT, fatalsignal); + signal(SIGTERM, fatalsignal); + signal(SIGSEGV, fatalsignal); + signal(SIGBUS, fatalsignal); + signal(SIGABRT, fatalsignal); + signal(SIGFPE, fatalsignal); + return 0; error: if (p->b.vidmem != MAP_FAILED) munmap(p->b.vidmem, fix.smem_len); |