View | Details | Raw Unified | Return to bug 232234
Collapse All | Expand All

(-)deskutils/pinot/Makefile (-1 / +1 lines)
Lines 3-9 Link Here
3
3
4
PORTNAME=	pinot
4
PORTNAME=	pinot
5
PORTVERSION=	1.09
5
PORTVERSION=	1.09
6
PORTREVISION=	12
6
PORTREVISION=	13
7
CATEGORIES=	deskutils
7
CATEGORIES=	deskutils
8
8
9
MAINTAINER=	thierry@FreeBSD.org
9
MAINTAINER=	thierry@FreeBSD.org
(-)deskutils/pinot/files/patch-openssl (+102 lines)
Line 0 Link Here
1
Description: Catch up with current glib and OpenSSL
2
Author: FabriceColin <fabrice.colin@gmail.com>
3
Bug-Debian: https://bugs.debian.org/828503
4
Forwarded: yes
5
Last-Update: 2018-06-14
6
7
diff --git Collect/DownloaderInterface.cpp Collect/DownloaderInterface.cpp
8
index 10f4f66..f084f50 100644
9
--- Collect/DownloaderInterface.cpp
10
+++ Collect/DownloaderInterface.cpp
11
@@ -1,5 +1,5 @@
12
 /*
13
- *  Copyright 2005-2008 Fabrice Colin
14
+ *  Copyright 2005-2017 Fabrice Colin
15
  *
16
  *  This program is free software; you can redistribute it and/or modify
17
  *  it under the terms of the GNU General Public License as published by
18
@@ -33,7 +33,8 @@ using namespace std;
19
 
20
 #ifdef USE_SSL
21
 // OpenSSL multi-thread support, required by Curl
22
-static pthread_mutex_t locksTable[CRYPTO_NUM_LOCKS];
23
+static unsigned int g_lockArrayCount = 0;
24
+static pthread_mutex_t *g_pLockArray = NULL;
25
 
26
 // OpenSSL locking functiom
27
 static void lockingCallback(int mode, int n, const char *file, int line)
28
@@ -42,7 +43,7 @@ static void lockingCallback(int mode, int n, const char *file, int line)
29
 
30
 	if (mode & CRYPTO_LOCK)
31
 	{
32
-		status = pthread_mutex_lock(&(locksTable[n]));
33
+		status = pthread_mutex_lock(&(g_pLockArray[n]));
34
 #ifdef DEBUG
35
 		if (status != 0)
36
 		{
37
@@ -52,7 +53,7 @@ static void lockingCallback(int mode, int n, const char *file, int line)
38
 	}
39
 	else
40
 	{
41
-		status = pthread_mutex_unlock(&(locksTable[n]));
42
+		status = pthread_mutex_unlock(&(g_pLockArray[n]));
43
 #ifdef DEBUG
44
 		if (status != 0)
45
 		{
46
@@ -82,9 +83,15 @@ void DownloaderInterface::initialize(void)
47
 	pthread_mutexattr_settype(&mutexAttr, PTHREAD_MUTEX_ERRORCHECK);
48
 
49
 	// Initialize the OpenSSL mutexes
50
-	for (unsigned int lockNum = 0; lockNum < CRYPTO_NUM_LOCKS; ++lockNum)
51
+#ifdef CRYPTO_num_locks
52
+	g_lockArrayCount = CRYPTO_num_locks();
53
+#else
54
+	g_lockArrayCount = CRYPTO_NUM_LOCKS;
55
+#endif
56
+	g_pLockArray = (pthread_mutex_t *)OPENSSL_malloc(g_lockArrayCount * sizeof(pthread_mutex_t));
57
+	for (unsigned int lockNum = 0; lockNum < g_lockArrayCount; ++lockNum)
58
 	{
59
-		pthread_mutex_init(&(locksTable[lockNum]), &mutexAttr);
60
+		pthread_mutex_init(&(g_pLockArray[lockNum]), &mutexAttr);
61
 	}
62
 	// Set the callbacks
63
 	CRYPTO_set_locking_callback(lockingCallback);
64
@@ -103,10 +110,13 @@ void DownloaderInterface::shutdown(void)
65
 	CRYPTO_set_locking_callback(NULL);
66
 
67
 	// Free the mutexes
68
-	for (unsigned int lockNum = 0; lockNum < CRYPTO_NUM_LOCKS; ++lockNum)
69
+	for (unsigned int lockNum = 0; lockNum < g_lockArrayCount; ++lockNum)
70
 	{
71
-		pthread_mutex_destroy(&(locksTable[lockNum]));
72
+		pthread_mutex_destroy(&(g_pLockArray[lockNum]));
73
 	}
74
+	OPENSSL_free(g_pLockArray);
75
+	g_pLockArray = NULL;
76
+	g_lockArrayCount = 0;
77
 #endif
78
 }
79
 
80
diff --git Utils/MIMEScanner.cpp Utils/MIMEScanner.cpp
81
index e02215c..50ceb3d 100644
82
--- Utils/MIMEScanner.cpp
83
+++ Utils/MIMEScanner.cpp
84
@@ -1,5 +1,5 @@
85
 /*
86
- *  Copyright 2005-2012 Fabrice Colin
87
+ *  Copyright 2005-2017 Fabrice Colin
88
  *
89
  *  This program is free software; you can redistribute it and/or modify
90
  *  it under the terms of the GNU General Public License as published by
91
@@ -456,9 +456,10 @@ MIMEScanner::~MIMEScanner()
92
 bool MIMEScanner::initialize(const string &userPrefix, const string &systemPrefix)
93
 {
94
 #ifdef USE_GIO
95
+#if !GLIB_CHECK_VERSION(2,35,0)
96
 	// Initialize the GType system
97
 	g_type_init();
98
-
99
+#endif
100
 	return true;
101
 #else
102
 	list<string> desktopFilesPaths;

Return to bug 232234