[BACK]Return to patch-main_bridge__channel.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / pkgsrc / comms / asterisk16 / patches

File: [cvs.NetBSD.org] / pkgsrc / comms / asterisk16 / patches / patch-main_bridge__channel.c (download)

Revision 1.1, Thu Feb 11 11:54:13 2021 UTC (8 months, 1 week ago) by ryoon
Branch: MAIN
CVS Tags: pkgsrc-2021Q3-base, pkgsrc-2021Q3, pkgsrc-2021Q2-base, pkgsrc-2021Q2, pkgsrc-2021Q1-base, pkgsrc-2021Q1, HEAD

asterisk16: Add forgotten patches

$NetBSD: patch-main_bridge__channel.c,v 1.1 2021/02/11 11:54:13 ryoon Exp $

* Fix segfault under NetBSD/aarch64 9.99.80.

--- main/bridge_channel.c.orig	2021-01-21 16:28:04.000000000 +0000
+++ main/bridge_channel.c
@@ -58,6 +58,13 @@
 #include "asterisk/stream.h"
 #include "asterisk/message.h"
 
+/* XXX, pthread_equal() is misused to compare non-valid thread pointers */
+static int
+pt_pthread_equal(pthread_t t1, pthread_t t2)
+{
+	return t1 == t2;
+}
+
 /*!
  * \brief Used to queue an action frame onto a bridge channel and write an action frame into a bridge.
  * \since 12.0.0
@@ -258,7 +265,7 @@ int ast_bridge_channel_notify_talking(st
  */
 static void bridge_channel_poke(struct ast_bridge_channel *bridge_channel)
 {
-	if (!pthread_equal(pthread_self(), bridge_channel->thread)) {
+	if (!pt_pthread_equal(pthread_self(), bridge_channel->thread)) {
 		/* Wake up the bridge channel thread. */
 		ast_queue_frame(bridge_channel->chan, &ast_null_frame);
 	}
@@ -971,7 +978,7 @@ static int bridge_channel_queue_action_d
 	};
 
 	/* Make sure we don't end up trying to wait on ourself to deliver the frame */
-	ast_assert(!pthread_equal(pthread_self(), bridge_channel->thread));
+	ast_assert(!pt_pthread_equal(pthread_self(), bridge_channel->thread));
 
 	sync_payload = ast_alloca(sync_payload_len);
 	sync_payload->id = ast_atomic_fetchadd_int(&sync_ids, +1);