scstadmin: Make -write_config save the scst_local session name (merge r4304 and r4305 from trunk)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@4593 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-11-03 14:49:46 +00:00
parent bc6da2b006
commit 7cc3997fd5

View File

@@ -2824,6 +2824,19 @@ sub targetAttributes {
$linked =~ s/.*\///;
$attributes{$attribute}->{'static'} = TRUE;
$attributes{$attribute}->{'value'} = $linked;
} elsif ($driver eq 'scst_local' && $attribute eq 'sessions') {
my $_session_path = make_path($_path, $attribute);
my $pSessHandle = new IO::Handle;
if (!(opendir $pSessHandle, $_session_path)) {
$self->{'err_string'} = "targetAttributes(): Unable to read directory '$_session_path': $!";
return undef;
}
my $key = 0;
foreach my $e (readdir($pSessHandle)) {
next if ($e eq '.' || $e eq '..');
$attributes{'session_name'}->{'keys'}->{$key}->{'value'} = $e;
$key++;
}
} elsif (-d $pPath) {
# Skip directories
} else {