summaryrefslogtreecommitdiff
path: root/sql/wsrep_utils.cc
diff options
context:
space:
mode:
authorAlexey Yurchenko <ayurchen@gmail.com>2014-12-10 23:29:28 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2015-05-04 13:04:52 -0400
commitb02d73656000107250b288c77668ce671fdacb10 (patch)
tree97414d2357f8b56195621a2e42847ed4370acd2a /sql/wsrep_utils.cc
parentc72ed05cdc215c14e41d0466a3d50d2c1a3a2033 (diff)
downloadmariadb-git-b02d73656000107250b288c77668ce671fdacb10.tar.gz
Refs #25 - made sure signals that may be set to ignored in mysqld were set to default in the child process.
Diffstat (limited to 'sql/wsrep_utils.cc')
-rw-r--r--sql/wsrep_utils.cc30
1 files changed, 29 insertions, 1 deletions
diff --git a/sql/wsrep_utils.cc b/sql/wsrep_utils.cc
index 099e6403dd6..ee87b9615a8 100644
--- a/sql/wsrep_utils.cc
+++ b/sql/wsrep_utils.cc
@@ -150,7 +150,35 @@ process::process (const char* cmd, const char* type)
goto cleanup_pipe;
}
- err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
+ /* make sure that no signlas are masked in child process */
+ sigset_t sigmask_empty; sigemptyset(&sigmask_empty);
+ err_ = posix_spawnattr_setsigmask(&attr, &sigmask_empty);
+ if (err_)
+ {
+ WSREP_ERROR ("posix_spawnattr_setsigmask() failed: %d (%s)",
+ err_, strerror(err_));
+ goto cleanup_attr;
+ }
+
+ /* make sure the following signals are not ignored in child process */
+ sigset_t default_signals; sigemptyset(&default_signals);
+ sigaddset(&default_signals, SIGHUP);
+ sigaddset(&default_signals, SIGINT);
+ sigaddset(&default_signals, SIGQUIT);
+ sigaddset(&default_signals, SIGPIPE);
+ sigaddset(&default_signals, SIGTERM);
+ sigaddset(&default_signals, SIGCHLD);
+ err_ = posix_spawnattr_setsigdefault(&attr, &default_signals);
+ if (err_)
+ {
+ WSREP_ERROR ("posix_spawnattr_setsigdefault() failed: %d (%s)",
+ err_, strerror(err_));
+ goto cleanup_attr;
+ }
+
+ err_ = posix_spawnattr_setflags (&attr, POSIX_SPAWN_SETSIGDEF |
+ POSIX_SPAWN_SETSIGMASK |
+ /* start a new process group */ POSIX_SPAWN_SETPGROUP |
POSIX_SPAWN_USEVFORK);
if (err_)
{