summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2008-08-13 10:35:47 +0000
committerOlivier Blin <oblin@mandriva.com>2008-08-13 10:35:47 +0000
commit55ad7f0d5839e465ade12c7c399cee9310c883f1 (patch)
tree266df27211b6a5a8565062cf7cd5113cb9b5db4f /lib
parent69abb009984591a846641fb5120a1340f7fc9357 (diff)
downloaddrakx-net-55ad7f0d5839e465ade12c7c399cee9310c883f1.tar
drakx-net-55ad7f0d5839e465ade12c7c399cee9310c883f1.tar.gz
drakx-net-55ad7f0d5839e465ade12c7c399cee9310c883f1.tar.bz2
drakx-net-55ad7f0d5839e465ade12c7c399cee9310c883f1.tar.xz
drakx-net-55ad7f0d5839e465ade12c7c399cee9310c883f1.zip
handle correctly LAST LINE comments when writing in /etc/shorewall/stop
Diffstat (limited to 'lib')
-rw-r--r--lib/network/shorewall.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/network/shorewall.pm b/lib/network/shorewall.pm
index a93af5d..7989583 100644
--- a/lib/network/shorewall.pm
+++ b/lib/network/shorewall.pm
@@ -38,9 +38,13 @@ sub get_config_file {
sub set_in_file {
my ($file, $enabled, @list) = @_;
+ my $done;
substInFile {
foreach my $l (@list) { s|^$l\n|| }
- $_ .= join("\n", @list) . "\n" if eof && $enabled;
+ if (!$done && $enabled && (/^#LAST LINE/ || eof)) {
+ $_ = join('', map { "$_\n" } @list) . $_;
+ $done = 1;
+ }
} "$::prefix/etc/shorewall/$file";
}