7076729 [cups] gs crashed and cups scheduler goes into maintenance
authorsonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
Mon, 12 Sep 2011 12:10:19 +0530
changeset 512 a83040d1e4ec
parent 511 f84d7a36b8c7
child 513 7cbcb75118e8
7076729 [cups] gs crashed and cups scheduler goes into maintenance
components/ghostscript/patches/12-7076729.patch
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/components/ghostscript/patches/12-7076729.patch	Mon Sep 12 12:10:19 2011 +0530
@@ -0,0 +1,42 @@
+--- ghostscript-9.00/base/gp_psync.c	Wed Jul 28 14:52:49 2010
++++ ghostscript-9.00/base/gp_psync.c	Fri Sep  9 12:12:13 2011
[email protected]@ -62,13 +62,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);
+-    if (scode == 0)
+-	scode = pthread_cond_init(&sem->cond, NULL);
++    scode = pthread_mutex_init(&tmp_mutex, NULL);
++    memcpy(&sem->mutex, &tmp_mutex, sizeof(pthread_mutex_t));
++    if (scode == 0) {
++	scode = pthread_cond_init(&tmp_cond, NULL);
++	memcpy(&sem->cond, &tmp_cond, sizeof(pthread_cond_t));
++    }
+     return SEM_ERROR_CODE(scode);
+ }
+ 
[email protected]@ -147,6 +152,7 @@
+ gp_monitor_open(gp_monitor * mona)
+ {
+     pthread_mutex_t *mon;
++    pthread_mutex_t  tmp_mutex;
+     int scode;
+ 
+     if (!mona)
[email protected]@ -153,7 +159,8 @@
+ 	return -1;		/* monitors are not movable */
+     mon = &((gp_pthread_recursive_t *)mona)->mutex;
+     ((gp_pthread_recursive_t *)mona)->self_id = 0;	/* Not valid unless mutex is locked */
+-    scode = pthread_mutex_init(mon, NULL);
++    scode = pthread_mutex_init(&tmp_mutex, NULL);
++    memcpy(mon, &tmp_mutex, sizeof(pthread_mutex_t));
+     return SEM_ERROR_CODE(scode);
+ }
+