scstadmin: Fix -close_dev

Avoid that closing a device fails and an empty export list is reported
if a device is currently not exported. This patch is based on a patch
provided by Dzmitry Kotsikau <dkotsikau@gmail.com>.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@7310 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2017-12-31 05:39:38 +00:00
parent 4d81f8e174
commit 41491391f8

View File

@@ -4751,7 +4751,8 @@ sub closeDevice {
my ($attributes, $errorString) = $SCST->deviceAttributes($device);
if (!$force) {
if (keys %{$$attributes{'exported'}}) {
if (keys %{$$attributes{'exported'}} &&
$$attributes{'exported'}->{'value'}) {
listExported($device, $attributes);
immediateExit("Device '$device' still in use, aborting. ".
"Use -force to override.");