From 3c1804eb0db5a450b1319721e8486fa537c85515 Mon Sep 17 00:00:00 2001
From: Richard Mudgett <rmudgett@digium.com>
Date: Fri, 26 Sep 2014 15:51:22 +0000
Subject: [PATCH] format_mp3: Made the get script conditionally apply patch if
 not already there.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@424039 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 contrib/scripts/get_mp3_source.sh | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/contrib/scripts/get_mp3_source.sh b/contrib/scripts/get_mp3_source.sh
index e1ee13bbdd..860e2bc02f 100755
--- a/contrib/scripts/get_mp3_source.sh
+++ b/contrib/scripts/get_mp3_source.sh
@@ -17,8 +17,10 @@ fi
 
 svn export http://svn.digium.com/svn/thirdparty/mp3/trunk addons/mp3 $@
 
-# Manually patch interface.c.
-sed -i -e '/#include "asterisk.h"/i#define WRAP_LIBC_MALLOC' \
-    addons/mp3/interface.c
+# Manually patch interface.c if not done yet.
+if ! grep -q WRAP_LIBC_MALLOC addons/mp3/interface.c; then
+    sed -i -e '/#include "asterisk.h"/i#define WRAP_LIBC_MALLOC' \
+        addons/mp3/interface.c
+fi
 
 exit 0
-- 
GitLab