scstadmin: Make -write_config save the scst_local session name

git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4304 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2012-05-17 12:18:48 +00:00
parent b0a24b829b
commit 00caf4d5c9

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 $session_name;
foreach my $e (readdir($pSessHandle)) {
next if ($e eq '.' || $e eq '..');
$session_name = $e;
}
$attributes{'session_name'}->{'keys'}->{'0'}->{'value'} = $session_name;
} elsif (-d $pPath) {
# Skip directories
} else {