|
From: Gleb C. <lna...@ya...> - 2024-01-30 07:55:57
|
Commit: f4f8da8 GitHub URL: https://github.com/SCST-project/scst/commit/f4f8da8b4dd324467e76caca1ca6f647e99a49e9 Author: Brian Meagher Date: 2024-01-30T10:55:25+03:00 Log Message: ----------- scstadmin: Eliminate use of uninitialized value in numeric error Using scstadmin to reload a configuration with fewer targets can result in a "Use of uninitialized value in numeric ne" error. Rectify by adding a check for the undefined value and handling the situation (by disabling the target in question, unless the driver is copy_manager). Modified Paths: -------------- scstadmin/scstadmin.sysfs/scstadmin | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) =================================================================== diff --git a/scstadmin/scstadmin.sysfs/scstadmin b/scstadmin/scstadmin.sysfs/scstadmin index 75d0ca8..84e539a 100755 --- a/scstadmin/scstadmin.sysfs/scstadmin +++ b/scstadmin/scstadmin.sysfs/scstadmin @@ -2831,10 +2831,17 @@ sub applyConfigEnableTargets { my $t_attributes; ($t_attributes, $errorString) = $SCST->targetAttributes($driver, $target); - if (defined($$t_attributes{'enabled'}) && - ($$t_attributes{'enabled'}->{'value'} != $$attributes{'enabled'})) { - setTargetAttribute($driver, $target, 'enabled', $$attributes{'enabled'}); - $changes++; + if (defined($$attributes{'enabled'})) { + if (defined($$t_attributes{'enabled'}) && + ($$t_attributes{'enabled'}->{'value'} != $$attributes{'enabled'})) { + setTargetAttribute($driver, $target, 'enabled', $$attributes{'enabled'}); + $changes++; + } + } else { + if ($driver ne 'copy_manager') { + setTargetAttribute($driver, $target, 'enabled', 0); + $changes++; + } } } } |