From 7ae8f388cf81c187f0cbfcc4997c93b28cf6c26a Mon Sep 17 00:00:00 2001 From: Sean D'Epagnier Date: Fri, 16 Feb 2007 17:44:13 -0700 Subject: Commiting a few minor fixes to glut fbdev (segfault on a separate stack) Updated all drivers that used the old _ac_ functions to use the new _vbo_ functions. I know this fixed the fbdev driver, it looks like it might fix some other drivers too. --- src/glut/fbdev/fbdev.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/glut/fbdev/fbdev.c') diff --git a/src/glut/fbdev/fbdev.c b/src/glut/fbdev/fbdev.c index 3b63cd70ea..80237f5bc7 100644 --- a/src/glut/fbdev/fbdev.c +++ b/src/glut/fbdev/fbdev.c @@ -173,6 +173,9 @@ void glutInit (int *argcp, char **argv) int RequiredWidth = 0, RequiredHeight; char *fbdev; + stack_t stack; + struct sigaction sa; + /* parse out args */ for (i = 1; i < *argcp;) { if (!strcmp(argv[i], "-geometry")) { @@ -239,7 +242,19 @@ void glutInit (int *argcp, char **argv) gettimeofday(&StartTime, 0); atexit(Cleanup); - signal(SIGSEGV, CrashHandler); + /* set up SIGSEGV to use alternate stack */ + stack.ss_flags = 0; + stack.ss_size = SIGSTKSZ; + if(!(stack.ss_sp = malloc(SIGSTKSZ))) + sprintf(exiterror, "Failed to allocate alternate stack for SIGSEGV!\n"); + + sigaltstack(&stack, NULL); + + sa.sa_handler = CrashHandler; + sa.sa_flags = SA_ONSTACK; + sigemptyset(&sa.sa_mask); + sigaction(SIGSEGV, &sa, NULL); + signal(SIGINT, CrashHandler); signal(SIGTERM, CrashHandler); signal(SIGABRT, CrashHandler); -- cgit v1.2.3