File 0013-remove-robust-mutex.patch of Package sssd.openSUSE_Leap_42.1_Update

diff -rupN sssd-1.11.5.1-original/Makefile.am sssd-1.11.5.1/Makefile.am
--- sssd-1.11.5.1-original/Makefile.am	2016-09-21 13:16:58.493530518 +0200
+++ sssd-1.11.5.1/Makefile.am	2016-09-21 13:34:54.196965401 +0200
@@ -519,10 +519,6 @@ endif
 
 CLIENT_LIBS = $(LTLIBINTL)
 
-if HAVE_PTHREAD
-CLIENT_LIBS += -lpthread
-endif
-
 #####################
 # Utility libraries #
 #####################
diff -rupN sssd-1.11.5.1-original/src/sss_client/common.c sssd-1.11.5.1/src/sss_client/common.c
--- sssd-1.11.5.1-original/src/sss_client/common.c	2016-09-21 13:16:58.505530646 +0200
+++ sssd-1.11.5.1/src/sss_client/common.c	2016-09-21 15:55:17.250982404 +0200
@@ -39,15 +39,12 @@
 #include <fcntl.h>
 #include <poll.h>
 #include <time.h>
+#include <pthread.h>
 
 #include <libintl.h>
 #define _(STRING) dgettext (PACKAGE, STRING)
 #include "sss_cli.h"
 
-#if HAVE_PTHREAD
-#include <pthread.h>
-#endif
-
 /*
 * Note we set MSG_NOSIGNAL to avoid
 * having to fiddle with signal masks
@@ -995,88 +992,31 @@ errno_t sss_strnlen(const char *str, siz
     return 0;
 }
 
-#if HAVE_PTHREAD
-typedef void (*sss_mutex_init)(void);
-
 struct sss_mutex {
     pthread_mutex_t mtx;
-
     pthread_once_t once;
-    sss_mutex_init init;
+    int old_cancel_state;
 };
 
-static void sss_nss_mt_init(void);
-static void sss_pam_mt_init(void);
-
 static struct sss_mutex sss_nss_mtx = { .mtx  = PTHREAD_MUTEX_INITIALIZER,
-                                        .once = PTHREAD_ONCE_INIT,
-                                        .init = sss_nss_mt_init };
+                                        .once = PTHREAD_ONCE_INIT };
 
 static struct sss_mutex sss_pam_mtx = { .mtx  = PTHREAD_MUTEX_INITIALIZER,
-                                        .once = PTHREAD_ONCE_INIT,
-                                        .init = sss_pam_mt_init };
-
-
-/* Wrappers for robust mutex support */
-static int sss_mutexattr_setrobust (pthread_mutexattr_t *attr)
-{
-#ifdef HAVE_PTHREAD_MUTEXATTR_SETROBUST
-    return pthread_mutexattr_setrobust(attr, PTHREAD_MUTEX_ROBUST);
-#elif  HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP
-    return pthread_mutexattr_setrobust_np(attr, PTHREAD_MUTEX_ROBUST_NP);
-#else
-#warning Robust mutexes are not supported on this platform.
-    return 0;
-#endif
-}
-
-static int sss_mutex_consistent(pthread_mutex_t *mtx)
-{
-#ifdef HAVE_PTHREAD_MUTEX_CONSISTENT
-    return pthread_mutex_consistent(mtx);
-#elif HAVE_PTHREAD_MUTEX_CONSISTENT_NP
-    return pthread_mutex_consistent_np(mtx);
-#else
-#warning Robust mutexes are not supported on this platform.
-    return 0;
-#endif
-}
-
-/* Generic mutex init, lock, unlock functions */
-static void sss_mt_init(struct sss_mutex *m)
-{
-    pthread_mutexattr_t attr;
-
-    if (pthread_mutexattr_init(&attr) != 0) {
-        return;
-    }
-    if (sss_mutexattr_setrobust(&attr) != 0) {
-        return;
-    }
-
-    pthread_mutex_init(&m->mtx, &attr);
-    pthread_mutexattr_destroy(&attr);
-}
+                                        .once = PTHREAD_ONCE_INIT };
 
 static void sss_mt_lock(struct sss_mutex *m)
 {
-    pthread_once(&m->once, m->init);
-    if (pthread_mutex_lock(&m->mtx) == EOWNERDEAD) {
-        sss_cli_close_socket();
-        sss_mutex_consistent(&m->mtx);
-    }
+    pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &m->old_cancel_state);
+    pthread_mutex_lock(&m->mtx);
 }
 
 static void sss_mt_unlock(struct sss_mutex *m)
 {
     pthread_mutex_unlock(&m->mtx);
+    pthread_setcancelstate(m->old_cancel_state, NULL);
 }
 
 /* NSS mutex wrappers */
-static void sss_nss_mt_init(void)
-{
-    sss_mt_init(&sss_nss_mtx);
-}
 void sss_nss_lock(void)
 {
     sss_mt_lock(&sss_nss_mtx);
@@ -1087,10 +1027,6 @@ void sss_nss_unlock(void)
 }
 
 /* NSS mutex wrappers */
-static void sss_pam_mt_init(void)
-{
-    sss_mt_init(&sss_pam_mtx);
-}
 void sss_pam_lock(void)
 {
     sss_mt_lock(&sss_pam_mtx);
@@ -1100,15 +1036,6 @@ void sss_pam_unlock(void)
     sss_mt_unlock(&sss_pam_mtx);
 }
 
-#else
-
-/* sorry no mutexes available */
-void sss_nss_lock(void) { return; }
-void sss_nss_unlock(void) { return; }
-void sss_pam_lock(void) { return; }
-void sss_pam_unlock(void) { return; }
-#endif
-
 
 errno_t sss_readrep_copy_string(const char *in,
                                 size_t *offset,