tdb_wrap: Make mutexes easier to use
authorVolker Lendecke <vl@samba.org>
Tue, 30 Sep 2014 11:04:21 +0000 (11:04 +0000)
committerMichael Adam <obnox@samba.org>
Thu, 20 Nov 2014 15:23:05 +0000 (16:23 +0100)
This patch makes sure we work fine and open without mutexes if they
are not supported.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
lib/tdb_wrap/tdb_wrap.c

index f2f32d1f085984a40a707c24d410677d0d0521cb..e762b334efe89c7d87e00ad0a779d98b9e377d04 100644 (file)
@@ -149,6 +149,13 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx,
        }
 
        if (w == NULL) {
+
+               if (tdb_flags & TDB_MUTEX_LOCKING) {
+                       if (!tdb_runtime_check_for_robust_mutexes()) {
+                               tdb_flags &= ~TDB_MUTEX_LOCKING;
+                       }
+               }
+
                w = tdb_wrap_private_open(result, name, hash_size, tdb_flags,
                                          open_flags, mode);
        } else {