summaryrefslogtreecommitdiffstats
path: root/perl-install/devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/devices.pm')
-rw-r--r--perl-install/devices.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/perl-install/devices.pm b/perl-install/devices.pm
index ac72bc3ed..7932eb21b 100644
--- a/perl-install/devices.pm
+++ b/perl-install/devices.pm
@@ -38,13 +38,16 @@ sub size($) {
sub make($) {
local $_ = my $file = $_[0];
my ($type, $major, $minor);
- my ($prefix);
+ my $prefix = '';
- unless (s,^(.*)/(dev|tmp)/,,) {
+ if (m,^(.*)/(dev|tmp)/(.*),) {
$prefix = $1;
- $file = -e "$prefix/dev/$file" ? "$prefix/dev/$file" : "$prefix/tmp/$file";
+ $_ = $3;
+ } elsif (m,/,) {
+ die "can't make device $file";
}
-
+ $file = "$prefix/dev/$_";
+ -e $file or $file = "$prefix/tmp/$_";
-e $file and return $file; # assume nobody takes fun at creating files named as device
if (/^sd(.)(\d{0,2})/) {