- Fix handling of /dev paths.

- Check for device paths which have a '/' in checkConfiuration().



git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1817 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Mark Buechler
2010-07-13 15:15:11 +00:00
parent 6527947abb
commit 9e11c29d06
2 changed files with 20 additions and 5 deletions

View File

@@ -2592,11 +2592,6 @@ sub handlerAttributes {
my $path = mkpath(SCST_ROOT, SCST_HANDLERS, $handler, $attribute);
if ($attribute =~ /\//) { # Hack
push @{$attributes{'devices'}->{'value'}}, $attribute;
next;
}
my $io = new IO::File $path, O_RDONLY;
if (!$io) {

View File

@@ -1272,6 +1272,26 @@ sub checkConfiguration {
}
}
foreach my $handler (sort keys %{$$CONFIG{'HANDLER'}}) {
foreach my $device (sort keys %{$$CONFIG{'HANDLER'}->{$handler}->{'DEVICE'}}) {
# Since some people may get confused with how to open
# a vcdrom, we'll support having '/dev/cdrom' instead of just 'cdrom'.
if ($device =~ /^\/dev\//) {
my $_device = $device;
$_device =~ s/^\/dev\///o;
my $tree = $$CONFIG{'HANDLER'}->{$handler}->{'DEVICE'}->{$device};
print "\t-> WARNING: Device '$device' configured for handler '$handler' may ".
"not contain the full /dev path, please change to '$_device'.\n";
delete $$CONFIG{'HANDLER'}->{$handler}->{'DEVICE'}->{$device};
$$CONFIG{'HANDLER'}->{$handler}->{'DEVICE'}->{$_device} = $tree;
} elsif ($device =~ /\//) {
print "\t-> FATAL: Device '$device' configured for handler '$handler' may not ".
"contain character '/'.\n";
return TRUE;
}
}
}
return FALSE;
}