pkgsrc/net/samba4/patches/patch-third__party_socket__wrapper_socket__wrapper.c
hauke 714c311d97 Solarish pthreads expect mutex datastructures to be properly zeroed
out, unlike the Linux implementation, which upstream mainly
targets. This leads to "tdb_open_ex: tdb_mutex_init failed for
/var/samba/lock/gencache.tdb: Device busy" errors, described in
<https://illumos.topicbox.com/groups/developer/T28dcabf2f69cac04>.

Illumos kernel code attempted to mitigate the problem as of
<https://www.illumos.org/issues/9959>, but the changes have yet to
show up in releases.

The patches originate from
<https://github.com/oposs/pkg.oetiker.ch-build/blob/master/build/samba4/patches/pthread_mutex_init>,
modified appropriately.

Tested on omniosce r151030.
2019-09-05 12:39:56 +00:00

23 lines
717 B
C

$NetBSD: patch-third__party_socket__wrapper_socket__wrapper.c,v 1.1 2019/09/05 12:39:56 hauke Exp $
On SunOS (OpenSolaris), pthread_mutex_init() expects a zeroed-out
mutex data structure
--- third_party/socket_wrapper/socket_wrapper.c.orig 2019-01-15 10:07:01.000000000 +0000
+++ third_party/socket_wrapper/socket_wrapper.c
@@ -1329,6 +1329,7 @@ static int socket_wrapper_init_mutex(pth
pthread_mutexattr_t ma;
int ret;
+ memset(ma, 0, sizeof(pthread_mutexattr_t));
ret = pthread_mutexattr_init(&ma);
if (ret != 0) {
return ret;
@@ -1339,6 +1340,7 @@ static int socket_wrapper_init_mutex(pth
goto done;
}
+ memset(m, 0, sizeof(pthread_mutex_t));
ret = pthread_mutex_init(m, &ma);
done: