summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table/dos.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/partition_table/dos.pm')
-rw-r--r--perl-install/partition_table/dos.pm20
1 files changed, 10 insertions, 10 deletions
diff --git a/perl-install/partition_table/dos.pm b/perl-install/partition_table/dos.pm
index b5f16df87..e448ad841 100644
--- a/perl-install/partition_table/dos.pm
+++ b/perl-install/partition_table/dos.pm
@@ -58,17 +58,17 @@ sub read {
my ($hd, $sector) = @_;
my $tmp;
- local *F; partition_table::raw::openit($hd, *F) or die "failed to open device";
- c::lseek_sector(fileno(F), $sector, $offset) or die "reading of partition in sector $sector failed";
+ my $F = partition_table::raw::openit($hd) or die "failed to open device";
+ c::lseek_sector(fileno($F), $sector, $offset) or die "reading of partition in sector $sector failed";
my @pt = map {
- sysread F, $tmp, psizeof($format) or die "error while reading partition table in sector $sector";
+ sysread $F, $tmp, psizeof($format) or die "error while reading partition table in sector $sector";
my %h; @h{@fields} = unpack $format, $tmp;
\%h;
} (1..$nb_primary);
#- check magic number
- sysread F, $tmp, length $magic or die "error reading magic number on disk $hd->{device}";
+ sysread $F, $tmp, length $magic or die "error reading magic number on disk $hd->{device}";
$tmp eq $magic or die "bad magic number on disk $hd->{device}";
[ @pt ];
@@ -80,13 +80,13 @@ sub write($$$;$) {
my ($hd, $sector, $pt) = @_;
#- handle testing for writing partition table on file only!
- local *F;
+ my $F;
if ($::testing) {
my $file = "/tmp/partition_table_$hd->{device}";
- open F, ">$file" or die "error opening test file $file";
+ open $F, ">$file" or die "error opening test file $file";
} else {
- partition_table::raw::openit($hd, *F, 2) or die "error opening device $hd->{device} for writing";
- c::lseek_sector(fileno(F), $sector, $offset) or return 0;
+ $F = partition_table::raw::openit($hd, 2) or die "error opening device $hd->{device} for writing";
+ c::lseek_sector(fileno($F), $sector, $offset) or return 0;
}
@$pt == $nb_primary or die "partition table does not have $nb_primary entries";
@@ -94,9 +94,9 @@ sub write($$$;$) {
compute_CHS($hd, $_);
local $_->{start} = $_->{local_start} || 0;
$_->{active} ||= 0; $_->{type} ||= 0; $_->{size} ||= 0; #- for no warning
- syswrite F, pack($format, @$_{@fields}), psizeof($format) or return 0;
+ syswrite $F, pack($format, @$_{@fields}), psizeof($format) or return 0;
}
- syswrite F, $magic, length $magic or return 0;
+ syswrite $F, $magic, length $magic or return 0;
1;
}