[SCM] Samba Shared Repository - branch master updated
Michael Adam
obnox at samba.org
Wed Mar 25 21:30:04 MDT 2015
The branch, master has been updated
via 05b61ea lib: tdb: Use sigaction when testing for robust mutexes.
from e8932b9 s3: client - "client use spnego principal = yes" code checks wrong name.
https://git.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 05b61ea47d1a30e6c37e46c199eb975f79099ed3
Author: Jeremy Allison <jra at samba.org>
Date: Fri Mar 20 10:59:08 2015 -0700
lib: tdb: Use sigaction when testing for robust mutexes.
Working fix that copes with oldact.sa_handler == NULL
if no handler initially set.
Fixes bug #11175 - Lots of winbindd zombie processes on Solaris platform.
https://bugzilla.samba.org/show_bug.cgi?id=11175
Signed-off-by: Jeremy Allison <jra at samba.org>
Reviewed-by: Michael Adam <obnox at samba.org>
Autobuild-User(master): Michael Adam <obnox at samba.org>
Autobuild-Date(master): Thu Mar 26 04:29:42 CET 2015 on sn-devel-104
-----------------------------------------------------------------------
Summary of changes:
lib/tdb/common/mutex.c | 35 +++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
Changeset truncated at 500 lines:
diff --git a/lib/tdb/common/mutex.c b/lib/tdb/common/mutex.c
index 12f89d3..fae43d4 100644
--- a/lib/tdb/common/mutex.c
+++ b/lib/tdb/common/mutex.c
@@ -713,6 +713,31 @@ cleanup_ma:
static void (*tdb_robust_mutext_old_handler)(int) = SIG_ERR;
static pid_t tdb_robust_mutex_pid = -1;
+static bool tdb_robust_mutex_setup_sigchild(void (*handler)(int),
+ void (**p_old_handler)(int))
+{
+#ifdef HAVE_SIGACTION
+ struct sigaction act;
+ struct sigaction oldact;
+
+ memset(&act, '\0', sizeof(act));
+
+ act.sa_handler = handler;
+#ifdef SA_RESTART
+ act.sa_flags = SA_RESTART;
+#endif
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, SIGCHLD);
+ sigaction(SIGCHLD, &act, &oldact);
+ if (p_old_handler) {
+ *p_old_handler = oldact.sa_handler;
+ }
+ return true;
+#else /* !HAVE_SIGACTION */
+ return false;
+#endif
+}
+
static void tdb_robust_mutex_handler(int sig)
{
if (tdb_robust_mutex_pid != -1) {
@@ -803,8 +828,10 @@ _PUBLIC_ bool tdb_runtime_check_for_robust_mutexes(void)
goto cleanup_ma;
}
- tdb_robust_mutext_old_handler = signal(SIGCHLD,
- tdb_robust_mutex_handler);
+ if (tdb_robust_mutex_setup_sigchild(tdb_robust_mutex_handler,
+ &tdb_robust_mutext_old_handler) == false) {
+ goto cleanup_ma;
+ }
tdb_robust_mutex_pid = fork();
if (tdb_robust_mutex_pid == 0) {
@@ -869,7 +896,7 @@ _PUBLIC_ bool tdb_runtime_check_for_robust_mutexes(void)
goto cleanup_child;
}
}
- signal(SIGCHLD, tdb_robust_mutext_old_handler);
+ tdb_robust_mutex_setup_sigchild(tdb_robust_mutext_old_handler, NULL);
ret = pthread_mutex_trylock(m);
if (ret != EOWNERDEAD) {
@@ -915,7 +942,7 @@ cleanup_child:
}
}
cleanup_sig_child:
- signal(SIGCHLD, tdb_robust_mutext_old_handler);
+ tdb_robust_mutex_setup_sigchild(tdb_robust_mutext_old_handler, NULL);
cleanup_m:
pthread_mutex_destroy(m);
cleanup_ma:
--
Samba Shared Repository
More information about the samba-cvs
mailing list