Index: trunk/src/sch-rnd/build_run.c =================================================================== --- trunk/src/sch-rnd/build_run.c (revision 2548) +++ trunk/src/sch-rnd/build_run.c (revision 2549) @@ -203,7 +203,7 @@ } /* Catches signals which abort the program. */ -void csch_catch_signal(int Signal) +void sch_rnd_catch_signal(int Signal) { const char *s; Index: trunk/src/sch-rnd/build_run.h =================================================================== --- trunk/src/sch-rnd/build_run.h (revision 2548) +++ trunk/src/sch-rnd/build_run.h (revision 2549) @@ -53,6 +53,6 @@ as a last resort from the OS */ const char *csch_author(void); -void csch_catch_signal(int Signal); +void sch_rnd_catch_signal(int Signal); #endif Index: trunk/src/sch-rnd/sch-rnd.c =================================================================== --- trunk/src/sch-rnd/sch-rnd.c (revision 2548) +++ trunk/src/sch-rnd/sch-rnd.c (revision 2549) @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -58,6 +59,7 @@ #include "conf_core.h" #include "crosshair.h" +#include "build_run.h" #include "sheet.h" #include "draw.h" #include "font.h" @@ -225,6 +227,39 @@ } +/* initialize signal and error handlers */ +static void main_sighand_init(void) +{ +#ifdef RND_HAVE_SIGHUP + signal(SIGHUP, sch_rnd_catch_signal); +#endif +#ifdef RND_HAVE_SIGQUIT + signal(SIGQUIT, sch_rnd_catch_signal); +#endif +#ifdef RND_HAVE_SIGTERM + signal(SIGTERM, sch_rnd_catch_signal); +#endif +#ifdef RND_HAVE_SIGINT + signal(SIGINT, sch_rnd_catch_signal); +#endif + +#ifdef NDEBUG +/* so that we get a core dump on segfault in debug mode */ +# ifdef RND_HAVE_SIGABRT + signal(SIGABRT, sch_rnd_catch_signal); +# endif +# ifdef RND_HAVE_SIGSEGV + signal(SIGSEGV, sch_rnd_catch_signal); +# endif +#endif + +/* calling external program by popen() may cause a PIPE signal, so we ignore it */ +#ifdef RND_HAVE_SIGPIPE + signal(SIGPIPE, SIG_IGN); +#endif +} + + static void gui_support_plugins(int load) { static int loaded = 0; @@ -438,6 +473,8 @@ } } + main_sighand_init(); + if (rnd_main_exported(&ga, &def_sheet->hidlib, 0)) { sch_rnd_main_uninit(); rnd_main_args_uninit(&ga);