diff options
author | Thierry Vignaud <tv@mageia.org> | 2012-10-17 16:54:52 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mageia.org> | 2012-10-17 16:54:52 +0000 |
commit | 591f339e3a342e1f53ba073af903f45720a5af09 (patch) | |
tree | e420e12519421092c9ef6ff3fbed753aee41be67 /dhcp_wizard | |
parent | a56d789ba6ce63ab379f525ad822e527924c3aed (diff) | |
download | drakwizard-591f339e3a342e1f53ba073af903f45720a5af09.tar drakwizard-591f339e3a342e1f53ba073af903f45720a5af09.tar.gz drakwizard-591f339e3a342e1f53ba073af903f45720a5af09.tar.bz2 drakwizard-591f339e3a342e1f53ba073af903f45720a5af09.tar.xz drakwizard-591f339e3a342e1f53ba073af903f45720a5af09.zip |
do not reinvent cat_or_die()
Diffstat (limited to 'dhcp_wizard')
-rwxr-xr-x | dhcp_wizard/Dhcp.pm | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/dhcp_wizard/Dhcp.pm b/dhcp_wizard/Dhcp.pm index 2fe1195f..23fd555f 100755 --- a/dhcp_wizard/Dhcp.pm +++ b/dhcp_wizard/Dhcp.pm @@ -212,9 +212,7 @@ sub do_it { if (!`grep INTERFACES $file`) { my $tmp = `/bin/mktemp /tmp/Dhcpconf.XXXXXX` or die "can't make a temp file: $!"; open(my $NEW, "> $tmp") or die "can't open $tmp: $!"; - open(my $OLD, "< $file") or die "can't open default: $!"; - local $_; - while (<$OLD>) { + foreach (cat_or_die($file)) { if (m|INTERFACE|) { print $NEW "# $_"; } @@ -222,7 +220,6 @@ sub do_it { print $NEW $_; } MDK::Common::append_to_file($tmp, "\n# Added by drakwizard\nINTERFACES=$wiz_device"); - close($OLD); close($NEW); chomp($tmp); system("mv $tmp $file"); |