summaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-29 20:34:17 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-03-29 20:34:17 +0000
commit53e1375cb6926b55a1487b61e5616b299e34e2be (patch)
tree66c641be525b9db654c34f5ab008b813a34832f1 /src/common
parent9cde26c90a6c3e55eddbee619958aea9b22c8de7 (diff)
downloadhercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.gz
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.bz2
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.tar.xz
hercules-53e1375cb6926b55a1487b61e5616b299e34e2be.zip
- Added "do_abort" function to the core. It is invoked when the server has received a Segmentation Fault or Floating Point Exception signal. Currently the only one that uses it is the map-server, which then attempts to save all online characters before aborting.
- Note that due to the current coding of the sig plugin, do_abort will not be invoked if you use it! This plugin needs to be updated... - Cleaned up a bit the change element code. val1 is the elemental level, val2 is the element now. - Hardcoded the element and elemental level of SC_CHANGEUNDEAD. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10089 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common')
-rw-r--r--src/common/core.c11
-rw-r--r--src/common/core.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/common/core.c b/src/common/core.c
index 5924a0aa6..60d25546a 100644
--- a/src/common/core.c
+++ b/src/common/core.c
@@ -92,6 +92,13 @@ static void sig_proc(int sn)
exit(0);
runflag = 0;
break;
+ case SIGSEGV:
+ case SIGFPE:
+ do_abort();
+ // Pass the signal to the system's default handler
+ compat_signal(sn, SIG_DFL);
+ raise(sn);
+ break;
#ifndef _WIN32
case SIGXFSZ:
// ignore and allow it to set errno to EFBIG
@@ -109,10 +116,10 @@ void signals_init (void)
{
compat_signal(SIGTERM, sig_proc);
compat_signal(SIGINT, sig_proc);
+ compat_signal(SIGSEGV, sig_proc);
+ compat_signal(SIGFPE, sig_proc);
// Signal to create coredumps by system when necessary (crash)
- compat_signal(SIGSEGV, SIG_DFL);
- compat_signal(SIGFPE, SIG_DFL);
compat_signal(SIGILL, SIG_DFL);
#ifndef _WIN32
compat_signal(SIGXFSZ, sig_proc);
diff --git a/src/common/core.h b/src/common/core.h
index 5e396cc7a..f59a87e3e 100644
--- a/src/common/core.h
+++ b/src/common/core.h
@@ -18,6 +18,7 @@ extern const char *get_svn_revision(void);
extern int do_init(int,char**);
extern void set_server_type(void);
extern void set_termfunc(void (*termfunc)(void));
+extern void do_abort(void);
extern void do_final(void);
#endif /* _CORE_H_ */