? cat test.c
#include <stdlib.h>
#include <sys/ucontext.h>
#include <signal.h>
void sigsegv_handler (int signo, siginfo_t *info, void *data) {
if (info != 0)
exit(1);
exit(0);
}
int main () {
int *foo;
struct sigaction sa;
sa.sa_sigaction = sigsegv_handler;
sa.sa_flags = SA_SIGINFO | SA_RESTART;
sigaction(SIGSEGV, &sa, NULL);
foo = NULL;
*foo = 3;
return 0;
}
? gcc -o test test.c
? ./test
? echo $?
1
? uname -a
Linux pizda.ninka.net 2.4.14-pre4 #1 SMP Mon Oct 29 18:55:18 PST 2001 sparc64 unknown
?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/