Let's try that again with accurate function and directory names:

diff -u asterisk-chan-capi-0.7.1/debian/patches/00list 
asterisk-chan-capi-0.7.1/debian/patches/00list
--- asterisk-chan-capi-0.7.1/debian/patches/00list
+++ asterisk-chan-capi-0.7.1/debian/patches/00list
@@ -1,0 +2 @@
+02_capi-cmsg2str-mutex
only in patch2:
unchanged:
--- asterisk-chan-capi-0.7.1.orig/debian/patches/02_capi-cmsg2str-mutex.dpatch
+++ asterisk-chan-capi-0.7.1/debian/patches/02_capi-cmsg2str-mutex.dpatch
@@ -0,0 +1,57 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_capi-msg2str-mutex.dpatch by Ben Hutchings <[EMAIL PROTECTED]>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Protect calls to capi_cmsg2str and use of its buffer with a mutex.
+
[EMAIL PROTECTED]@
+--- asterisk-chan-capi-0.7.1/chan_capi.c~      2006-10-08 13:38:27.000000000 
+0000
++++ asterisk-chan-capi-0.7.1/chan_capi.c       2007-02-17 22:26:32.000000000 
+0000
+@@ -167,6 +167,8 @@
+  * 4. cc_mutex_lock(&messagenumber_lock);
+  * 5. cc_mutex_lock(&usecnt_lock);
+  * 6. cc_mutex_lock(&capi_put_lock);
++ * 7. cc_mutex_lock(&capi_cmsg2str_lock);
++ * 8. cc_mutex_lock(&verbose_lock);
+  *
+  *
+  *  ** the PBX will call the callback functions with 
+@@ -180,6 +182,7 @@
+ AST_MUTEX_DEFINE_STATIC(usecnt_lock);
+ AST_MUTEX_DEFINE_STATIC(iflock);
+ AST_MUTEX_DEFINE_STATIC(capi_put_lock);
++AST_MUTEX_DEFINE_STATIC(capi_cmsg2str_lock);
+ AST_MUTEX_DEFINE_STATIC(verbose_lock);
+ 
+ static int capi_capability = AST_FORMAT_ALAW;
+@@ -402,6 +405,7 @@
+               return -1;
+       }
+ 
++      cc_mutex_lock(&capi_cmsg2str_lock);
+       if (error) {
+               cc_log(LOG_ERROR, "CAPI error sending %s (NCCI=%#x) (error=%#x 
%s)\n",
+                       capi_cmsg2str(CMSG), (unsigned int)HEADER_CID(CMSG),
+@@ -415,6 +419,7 @@
+                       cc_verbose(4, 1, "%s\n", capi_cmsg2str(CMSG));
+               }
+       }
++      cc_mutex_unlock(&capi_cmsg2str_lock);
+ 
+       return error;
+ }
+@@ -3972,12 +3977,14 @@
+       unsigned short wInfo = 0xffff;
+       struct capi_pvt *i = find_interface_by_plci(PLCI);
+ 
++      cc_mutex_lock(&capi_cmsg2str_lock);
+       if ((wCmd == CAPI_P_IND(DATA_B3)) ||
+           (wCmd == CAPI_P_CONF(DATA_B3))) {
+               cc_verbose(7, 1, "%s\n", capi_cmsg2str(CMSG));
+       } else {
+               cc_verbose(4, 1, "%s\n", capi_cmsg2str(CMSG));
+       }
++      cc_mutex_unlock(&capi_cmsg2str_lock);
+ 
+       if (i != NULL)
+               cc_mutex_lock(&i->lock);
-- END --

-- 
Ben Hutchings
It is easier to change the specification to fit the program than vice versa.

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to