[asterisk-commits] dhubbard: branch 1.4 r215270 - /branches/1.4/apps/app_softhangup.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 1 18:04:55 CDT 2009


Author: dhubbard
Date: Tue Sep  1 18:04:52 2009
New Revision: 215270

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215270
Log:
Use strrchr() so SoftHangup will correctly truncate multi-hyphen channel names

In general channel names are in the form Foo/Bar-Z, but the channel name
could have multiple hyphens and look like Foo/B-a-r-Z.  Use strrchr to
truncate the channel name at the last hyphen.

(closes issue #15810)
Reported by: dhubbard
Patches:
      dw-softhangup-1.4.patch uploaded by dhubbard (license 733)


Modified:
    branches/1.4/apps/app_softhangup.c

Modified: branches/1.4/apps/app_softhangup.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.4/apps/app_softhangup.c?view=diff&rev=215270&r1=215269&r2=215270
==============================================================================
--- branches/1.4/apps/app_softhangup.c (original)
+++ branches/1.4/apps/app_softhangup.c Tue Sep  1 18:04:52 2009
@@ -79,11 +79,13 @@
 		/* XXX watch out, i think it is wrong to access c-> after unlocking! */
 		if (all) {
 			/* CAPI is set up like CAPI[foo/bar]/clcnt */ 
-			if (!strcmp(c->tech->type, "CAPI")) 
+			if (!strcmp(c->tech->type, "CAPI")) {
 				cut = strrchr(name,'/');
 			/* Basically everything else is Foo/Bar-Z */
-			else
-				cut = strchr(name,'-');
+			} else {
+				/* use strrchr() because Foo/Bar-Z could actually be Foo/B-a-r-Z */
+				cut = strrchr(name,'-');
+			}
 			/* Get rid of what we've cut */
 			if (cut)
 				*cut = 0;




More information about the asterisk-commits mailing list