summaryrefslogtreecommitdiffstats
path: root/perl-install/common.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2002-12-03 12:33:19 +0000
committerPascal Rigaux <pixel@mandriva.com>2002-12-03 12:33:19 +0000
commit0d7b3d569befdbafbbe8b8c989f9f9ab0164b086 (patch)
tree56dad7e8b520aaef2bb105232f64a7ad5f2abd33 /perl-install/common.pm
parent3ea0f2dda653d67df19ca19189b6eb7fa94b93b6 (diff)
downloaddrakx-backup-do-not-use-0d7b3d569befdbafbbe8b8c989f9f9ab0164b086.tar
drakx-backup-do-not-use-0d7b3d569befdbafbbe8b8c989f9f9ab0164b086.tar.gz
drakx-backup-do-not-use-0d7b3d569befdbafbbe8b8c989f9f9ab0164b086.tar.bz2
drakx-backup-do-not-use-0d7b3d569befdbafbbe8b8c989f9f9ab0164b086.tar.xz
drakx-backup-do-not-use-0d7b3d569befdbafbbe8b8c989f9f9ab0164b086.zip
use "my $F" instead of "local *F" (and cleanup)
Diffstat (limited to 'perl-install/common.pm')
-rw-r--r--perl-install/common.pm21
1 files changed, 10 insertions, 11 deletions
diff --git a/perl-install/common.pm b/perl-install/common.pm
index 73d4ed9d8..0353da552 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -34,12 +34,11 @@ sub N_ { $_[0] }
sub salt {
my ($nb) = @_;
require devices;
- local *F;
- open F, devices::make("random") or die "missing random";
- my $s; read F, $s, $nb;
- local $_ = pack "b8" x $nb, unpack "b6" x $nb, $s;
- tr|\0-\x3f|0-9a-zA-Z./|;
- $_;
+ open my $F, devices::make("random") or die "missing random";
+ my $s; read $F, $s, $nb;
+ $s = pack("b8" x $nb, unpack "b6" x $nb, $s);
+ $s =~ tr|\0-\x3f|0-9a-zA-Z./|;
+ $s;
}
sub makedev { ($_[0] << 8) | $_[1] }
@@ -71,12 +70,12 @@ sub availableRamMB() {
}
sub setVirtual {
+ my ($vt_number) = @_;
my $vt = '';
- local *C;
- sysopen C, "/dev/console", 2 or die "failed to open /dev/console: $!";
- ioctl(C, c::VT_GETSTATE(), $vt) or die "ioctl VT_GETSTATE failed";
- ioctl(C, c::VT_ACTIVATE(), $_[0]) or die "ioctl VT_ACTIVATE failed";
- ioctl(C, c::VT_WAITACTIVE(), $_[0]) or die "ioctl VT_WAITACTIVE failed";
+ sysopen my $C, "/dev/console", 2 or die "failed to open /dev/console: $!";
+ ioctl($C, c::VT_GETSTATE(), $vt) &&
+ ioctl($C, c::VT_ACTIVATE(), $vt_number) &&
+ ioctl($C, c::VT_WAITACTIVE(), $vt_number) or die "setVirtual failed";
unpack "S", $vt;
}