summaryrefslogtreecommitdiff
path: root/lib/tdb
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2016-11-21 21:00:01 +0100
committerJeremy Allison <jra@samba.org>2016-11-29 23:59:52 +0100
commit275d9fc7d943048c5e580e656b6ad85b8fc6cc14 (patch)
tree5820dbefe5b7648c50916d8089dd95cb44cede5e /lib/tdb
parent5ce95abf37d5646dd5a6ed9acc018f0ab5d1023c (diff)
downloadsamba-275d9fc7d943048c5e580e656b6ad85b8fc6cc14.tar.gz
tdb: Fix mutexes on FreeBSD
susv4 on mmap has the following snippet: > The state of synchronization objects such as mutexes, semaphores, > barriers, and conditional variables placed in shared memory mapped > with MAP_SHARED becomes undefined when the last region in any process > containing the synchronization object is unmapped. This means we can't keep the mutex mmap area unmapped at any point in time. BUG: https://bugzilla.samba.org/show_bug.cgi?id=12455 Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Tue Nov 29 23:59:52 CET 2016 on sn-devel-144
Diffstat (limited to 'lib/tdb')
-rw-r--r--lib/tdb/common/mutex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/tdb/common/mutex.c b/lib/tdb/common/mutex.c
index 3df9f5b06ad..cac3916713f 100644
--- a/lib/tdb/common/mutex.c
+++ b/lib/tdb/common/mutex.c
@@ -603,12 +603,13 @@ int tdb_mutex_init(struct tdb_context *tdb)
fail:
pthread_mutexattr_destroy(&ma);
fail_munmap:
- tdb_mutex_munmap(tdb);
if (ret == 0) {
return 0;
}
+ tdb_mutex_munmap(tdb);
+
errno = ret;
return -1;
}