- 论坛徽章:
- 59
|
- void sigexit_handler(int param){
- if(param == SIGSEGV)
- printf("SIGSEGV :");
- printf("退出\n");
- }
复制代码 you do nothing about above code. while seg failt occurs, you handler be called, and just do nothing.
so that after your handler returned, the kernel try to resume the failed instrument.
of course it lead to a new failing.
seg failt always fatal error in a program. & it is very difficulty to fix (in many cast-- reach & near to all, it is impossible to fix), so,
don't try to fix a segment failing.
you can change your code to:
- void sigexit_handler(int param){
- if(param == SIGSEGV)
- printf("SIGSEGV :");
- printf("退出\n");
- exit(-1); // Fatal failure& can't be fixed.
- }
复制代码 |
|