Forráskód Böngészése

Fix compile errors

bel 9 éve
szülő
commit
4eb38685e7
1 módosított fájl, 5 hozzáadás és 3 törlés
  1. 5 3
      src/civetweb.c

+ 5 - 3
src/civetweb.c

@@ -9618,13 +9618,15 @@ static unsigned long ssl_id_callback(void)
 	return GetCurrentThreadId();
 	return GetCurrentThreadId();
 #else
 #else
 	if (sizeof(pthread_t) > sizeof(unsigned long)) {
 	if (sizeof(pthread_t) > sizeof(unsigned long)) {
+		/* This is the problematic case for CRYPTO_set_id_callback:
+		 * The OS pthread_t can not be cast to unsigned long. */
 		struct mg_workerTLS *tls =
 		struct mg_workerTLS *tls =
 		    (struct mg_workerTLS *)pthread_getspecific(sTlsKey);
 		    (struct mg_workerTLS *)pthread_getspecific(sTlsKey);
 		if (tls == NULL) {
 		if (tls == NULL) {
 			/* SSL called from an unknown thread: Create some thread index. */
 			/* SSL called from an unknown thread: Create some thread index. */
-			tls = mg_malloc(sizeof(struct mg_workerTLS));
-			tls.is_master = -2; /* -2 means "3rd party thread" */
-			tls.thread_idx = (unsigned)mg_atomic_inc(&thread_idx_max);
+			tls = (struct mg_workerTLS *)mg_malloc(sizeof(struct mg_workerTLS));
+			tls->is_master = -2; /* -2 means "3rd party thread" */
+			tls->thread_idx = (unsigned)mg_atomic_inc(&thread_idx_max);
 			pthread_setspecific(sTlsKey, tls);
 			pthread_setspecific(sTlsKey, tls);
 		}
 		}
 		return tls->thread_idx;
 		return tls->thread_idx;