From f6018a89e009ba37057d6b4e0b68867479c4e774 Mon Sep 17 00:00:00 2001
From: Greg Brockman <gdb@mit.edu>
Date: Mon, 18 Jan 2010 03:32:44 -0500
Subject: [PATCH] Make sed not hang when there are no firewall files

svn path=/trunk/packages/invirt-iptables/; revision=2905
---
 debian/changelog            |    6 ++++++
 debian/invirt-iptables.init |   12 ++++++++----
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 493d73e..404419b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+invirt-iptables (1.0.1) unstable; urgency=low
+
+  * Make sed not hang when there are no firewall files
+
+ -- Greg Brockman <gdb@mit.edu>  Mon, 18 Jan 2010 03:30:21 -0500
+
 invirt-iptables (1) unstable; urgency=low
 
   * Initial Release.
diff --git a/debian/invirt-iptables.init b/debian/invirt-iptables.init
index e2b8c6f..ca3e6f8 100755
--- a/debian/invirt-iptables.init
+++ b/debian/invirt-iptables.init
@@ -22,10 +22,14 @@ do_start()
 {
         echo 1 > /proc/sys/net/ipv4/ip_forward
 
-        for table in $(sed -ne 's/^*//p' $(run-parts --list "$RULES")); do
-            iptables -t "$table" -F
-        done
-	cat $(run-parts --list "$RULES") | iptables-restore -n
+	list=$(run-parts --list "$RULES")
+
+	if [ ! -z "$list" ]; then
+            for table in $(sed -ne 's/^*//p' $list); do
+		iptables -t "$table" -F
+            done
+	    cat $list | iptables-restore -n
+	fi
 }
 
 do_reload()
-- 
1.7.9.5