From a1ff4f84e63a0038e373188144b8a36cfe2f3ccc Mon Sep 17 00:00:00 2001
From: fluxgen <fluxgen>
Date: Mon, 12 Jan 2004 11:14:55 +0000
Subject: limit looping

---
 util/fluxbox-generate_menu.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/util/fluxbox-generate_menu.in b/util/fluxbox-generate_menu.in
index 199bc30..aba7b04 100755
--- a/util/fluxbox-generate_menu.in
+++ b/util/fluxbox-generate_menu.in
@@ -22,7 +22,7 @@
 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 # DEALINGS IN THE SOFTWARE.
 #
-# $Id: fluxbox-generate_menu.in,v 1.10 2004/01/03 00:43:43 fluxgen Exp $
+# $Id: fluxbox-generate_menu.in,v 1.11 2004/01/12 11:14:55 fluxgen Exp $
 
 #
 # Portability notes:
@@ -220,8 +220,11 @@ clean_up() {
 # Some magic to clean up empty menus
 rm -f ${MENUFILENAME}.tmp
 touch ${MENUFILENAME}.tmp
-until diff -u ${MENUFILENAME} ${MENUFILENAME}.tmp > /dev/null 2>&1; do
+local counter=10 # prevent looping in odd circumstances
+until [ $counter -lt 1 ] || \
+    diff -u ${MENUFILENAME} ${MENUFILENAME}.tmp 2>&1 > /dev/null; do
     [ -s ${MENUFILENAME}.tmp ] && mv ${MENUFILENAME}.tmp ${MENUFILENAME}
+    counter=`expr $counter - 1`
     grep -v '^$' ${MENUFILENAME}|sed -e "/^\[submenu].*/{
 n
 N
-- 
cgit v0.11.2