diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-12-05 15:51:24 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-12-06 09:45:50 +0100 |
commit | 76546a099c24a06ad89238f61435051a4663b112 (patch) | |
tree | 55ed7fabe4f8e1d2975cc039f8805dad81ca8e71 /sql/signal_handler.cc | |
parent | 5142cd55f492a2c9a2e308e168c86278765f95c3 (diff) | |
download | mariadb-git-76546a099c24a06ad89238f61435051a4663b112.tar.gz |
MDEV-10382 Using systemd, mariadb doesn't restart on crashes
when crashing on a signal, don't exit(), but re-signal it, so that
the caller could check WIFSIGNALED()
Diffstat (limited to 'sql/signal_handler.cc')
-rw-r--r-- | sql/signal_handler.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index f72eb676743..6593c3f3dbc 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -75,7 +75,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) if (segfaulted) { my_safe_printf_stderr("Fatal " SIGNAL_FMT " while backtracing\n", sig); - _exit(1); /* Quit without running destructors */ + goto end; } segfaulted = 1; @@ -301,9 +301,11 @@ end: #ifndef __WIN__ /* Quit, without running destructors (etc.) + Use a signal, because the parent (systemd) can check that with WIFSIGNALED On Windows, do not terminate, but pass control to exception filter. */ - _exit(1); // Using _exit(), since exit() is not async signal safe + signal(sig, SIG_DFL); + kill(getpid(), sig); #else return; #endif |