File s390-tools-sles11-lzfcp-nodev-check of Package s390-tools
Description: lszfcp: throw error message if no devices are configured.
Symptom: A shell error is shown if no devices are configured.
Problem: The path to query is not existing.
Solution: Verify the query path and its content
---
zconf/lszfcp | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Index: s390-tools-sles11/zconf/lszfcp
===================================================================
--- s390-tools-sles11.orig/zconf/lszfcp
+++ s390-tools-sles11/zconf/lszfcp
@@ -225,12 +225,16 @@ show_devices()
# Differentiate old and new sysfs layout
if $FC_CLASS; then
SCSI_DEVICE_LIST=`ls -d \
- $SYSFS/devices/css0/*/*/host*/rport*/target*/*/ |\
- grep -P '\d+:\d+:\d+:\d+'`
+ $SYSFS/devices/css0/*/*/host*/rport*/target*/*/ \
+ 2>/dev/null |grep -P '\d+:\d+:\d+:\d+'`
else
SCSI_DEVICE_LIST=`ls -d $SYSFS/devices/css0/*/*/host*/*/`
fi
+ if [ -z "$SCSI_DEVICE_LIST" ]; then
+ echo "Error: No fcp devices found."
+ fi
+
for SCSI_DEVICE_PATH in $SCSI_DEVICE_LIST; do
read ADAPTER < $SCSI_DEVICE_PATH/hba_id
read WWPN < $SCSI_DEVICE_PATH/wwpn