components/ghostscript/patches/12-7076729.patch
author Rich Burridge <rich.burridge@oracle.com>
Tue, 02 May 2017 17:33:26 -0700
changeset 7964 d9801318ed3d
parent 7819 b1bca76ec901
permissions -rw-r--r--
25981468 Build ilmbase and openexr with the GNU compilers

Solaris-specific; not suitable for upstream

--- ghostscript-9.20/base/gp_psync.c	2016-09-26 03:41:28.000000000 -0700
+++ ghostscript-9.20/base/gp_psync.c	2016-10-05 04:19:36.456692671 -0700
@@ -65,14 +65,18 @@
 {
     pt_semaphore_t * const sem = (pt_semaphore_t *)sema;
     int scode;
+    pthread_mutex_t tmp_mutex;
+    pthread_cond_t tmp_cond;
 
     if (!sema)
         return -1;		/* semaphores are not movable */
     sem->count = 0;
-    scode = pthread_mutex_init(&sem->mutex, NULL);
+    scode = pthread_mutex_init(&tmp_mutex, NULL);
+    memcpy(&sem->mutex, &tmp_mutex, sizeof(pthread_mutex_t));
     if (scode == 0)
     {
-        scode = pthread_cond_init(&sem->cond, NULL);
+        scode = pthread_cond_init(&tmp_cond, NULL);
+        memcpy(&sem->cond, &tmp_cond, sizeof(pthread_cond_t));
         if (scode)
             pthread_mutex_destroy(&sem->mutex);
     }
@@ -162,6 +166,7 @@
 gp_monitor_open(gp_monitor * mona)
 {
     pthread_mutex_t *mon;
+    pthread_mutex_t  tmp_mutex;
     int scode;
     pthread_mutexattr_t attr;
     pthread_mutexattr_t *attrp = NULL;
@@ -185,7 +190,8 @@
 #endif
 
     mon = &((gp_pthread_recursive_t *)mona)->mutex;
-    scode = pthread_mutex_init(mon, attrp);
+    scode = pthread_mutex_init(&tmp_mutex, NULL);
+    memcpy(mon, &tmp_mutex, sizeof(pthread_mutex_t));
     if (attrp)
         (void)pthread_mutexattr_destroy(attrp);
 done: