jenkins-core-weekly: update to 2.491
[oi-userland.git] / components / library / libsmbclient / patches / 06-memset_for_pthread_mutex_init.patch
bloba2cbb6447d51c512246a196d19299694a8d2add6
1 # This patch is related to https://www.illumos.org/issues/9959.
2 # For some reason the underlying OS does not memset the mutex to zero.
3 # Therefore this patch does it.
5 diff -Naur samba-4.10.2.orig/lib/tdb/common/mutex.c samba-4.10.2/lib/tdb/common/mutex.c
6 --- samba-4.10.2.orig/lib/tdb/common/mutex.c 2019-04-20 07:46:16.548548581 +0000
7 +++ samba-4.10.2/lib/tdb/common/mutex.c 2019-04-21 11:12:25.665046799 +0000
8 @@ -587,6 +587,7 @@
9 for (i=0; i<tdb->hash_size+1; i++) {
10 pthread_mutex_t *chain = &m->hashchains[i];
12 + (void) memset(chain, 0, sizeof(*chain));
13 ret = pthread_mutex_init(chain, &ma);
14 if (ret != 0) {
15 goto fail;
16 @@ -595,6 +596,7 @@
18 m->allrecord_lock = F_UNLCK;
20 + (void) memset(&m->allrecord_mutex, 0, sizeof(m->allrecord_mutex));
21 ret = pthread_mutex_init(&m->allrecord_mutex, &ma);
22 if (ret != 0) {
23 goto fail;
24 @@ -885,6 +887,7 @@
25 if (ret != 0) {
26 goto cleanup;
28 + (void) memset(ptr, 0, sizeof(*ptr));
29 ret = pthread_mutex_init(ptr, &ma);
30 if (ret != 0) {
31 goto cleanup;