[mw-devel] MW3 r1364 - trunk/src/client

arthur at sucs.org arthur at sucs.org
Fri May 30 09:59:51 BST 2014


Author: arthur
Date: 2014-05-30 09:59:50 +0100 (Fri, 30 May 2014)
New Revision: 1364

Modified:
   trunk/src/client/log.c
   trunk/src/client/main.c
Log:
Try and avoid the race condition in gnutls that makes it not thread-safe


Modified: trunk/src/client/log.c
===================================================================
--- trunk/src/client/log.c	2014-05-30 08:33:07 UTC (rev 1363)
+++ trunk/src/client/log.c	2014-05-30 08:59:50 UTC (rev 1364)
@@ -250,6 +250,7 @@
 	md = md5(url);
 	snprintf(path,sizeof(path), "http://feeds.delicious.com/v2/json/urlinfo/%s", md);
 	free(md);
+	curl_easy_setopt(c, CURLOPT_NOSIGNAL, 1);
 	curl_easy_setopt(c, CURLOPT_URL, path);
 	curl_easy_setopt(c, CURLOPT_NOPROGRESS, 1);
 	curl_easy_setopt(c, CURLOPT_AUTOREFERER, 1);

Modified: trunk/src/client/main.c
===================================================================
--- trunk/src/client/main.c	2014-05-30 08:33:07 UTC (rev 1363)
+++ trunk/src/client/main.c	2014-05-30 08:59:50 UTC (rev 1364)
@@ -384,6 +384,13 @@
 	ignored = NULL;
 	output=stdout;
 
+#ifdef GNUTLS_VERSION_MAJOR
+	/* Prior to 3.3.0 this is not thread safe
+	 * so should be done early to prevent a race.
+	 **/
+	gnutls_global_init();
+#endif
+
 #ifdef NEED_LINEBUF
 	setlinebuf(stdout);
 	setlinebuf(stderr);




More information about the mw-devel mailing list