diff options
author | unknown <msvensson@neptunus.(none)> | 2006-05-19 13:07:24 +0200 |
---|---|---|
committer | unknown <msvensson@neptunus.(none)> | 2006-05-19 13:07:24 +0200 |
commit | 5ceb394fe22182055cb16b99bec3c6fe6b1dc3d8 (patch) | |
tree | 19df7c9973c569b5cc78b2f67a58e6f18c0c0aa2 | |
parent | 1bdb7f7789f4c1b02a97210e3818d49f6e064bc2 (diff) | |
download | mariadb-git-5ceb394fe22182055cb16b99bec3c6fe6b1dc3d8.tar.gz |
Bug#15869 Cannot shutdown the server - it restarts
- A segfault occured when the function 'kill_server' called
'my_sigset' with signal number 0. 'my_sigset' is a macro which
uses 'sigaction' to install the signal handler with an invalid
signal number will on most platforms return EINVAL but yields
a segfauilt on IRIX 6.5
- The server crash was detected by mysqld_safe and it was restarted although
a shutdown was requested.
- Semantics of kill_server(0) is not known, leaving it intact
include/my_pthread.h:
Check return value from sigaction with a DBUG_ASSERT
Also DBUG_ASSERT if signal number 0 is passed
sql/mysqld.cc:
Don't call my_sigset if signo is 0
-rw-r--r-- | include/my_pthread.h | 6 | ||||
-rw-r--r-- | sql/mysqld.cc | 3 |
2 files changed, 6 insertions, 3 deletions
diff --git a/include/my_pthread.h b/include/my_pthread.h index b6b65d4389a..8d03de49574 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -329,12 +329,14 @@ int sigwait(sigset_t *setp, int *sigp); /* Use our implemention */ we want to make sure that no such flags are set. */ #if defined(HAVE_SIGACTION) && !defined(my_sigset) -#define my_sigset(A,B) do { struct sigaction s; sigset_t set; \ +#define my_sigset(A,B) do { struct sigaction s; sigset_t set; int rc; \ + DBUG_ASSERT((A) != 0); \ sigemptyset(&set); \ s.sa_handler = (B); \ s.sa_mask = set; \ s.sa_flags = 0; \ - sigaction((A), &s, (struct sigaction *) NULL); \ + rc= sigaction((A), &s, (struct sigaction *) NULL);\ + DBUG_ASSERT(rc == 0); \ } while (0) #elif defined(HAVE_SIGSET) && !defined(my_sigset) #define my_sigset(A,B) sigset((A),(B)) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 740e1a419c7..9c1089dbdb2 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -884,7 +884,8 @@ static void __cdecl kill_server(int sig_ptr) RETURN_FROM_KILL_SERVER; kill_in_progress=TRUE; abort_loop=1; // This should be set - my_sigset(sig,SIG_IGN); + if (sig != 0) // 0 is not a valid signal number + my_sigset(sig,SIG_IGN); if (sig == MYSQL_KILL_SIGNAL || sig == 0) sql_print_information(ER(ER_NORMAL_SHUTDOWN),my_progname); else |