2073b1
From 80b570a1f890d2912418f7698213dfca40443fa1 Mon Sep 17 00:00:00 2001
2073b1
From: "Nitin U. Yewale" <nyewale@redhat.com>
2073b1
Date: Mon, 3 Jan 2022 13:12:12 +0530
2073b1
Subject: [PATCH] fix crash with rescan-scsi-bus.sh -r
2073b1
2073b1
---
2073b1
 scripts/rescan-scsi-bus.sh | 6 ++++++
2073b1
 1 file changed, 6 insertions(+)
2073b1
2073b1
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
2073b1
index 46fe6c0..e34ea35 100755
2073b1
--- a/scripts/rescan-scsi-bus.sh
2073b1
+++ b/scripts/rescan-scsi-bus.sh
2073b1
@@ -307,7 +307,13 @@ testonline ()
2073b1
   IPREV=$(echo "$INQ" | grep 'Product revision level:' | sed 's/^[^:]*: \(.*\)$/\1/')
2073b1
   STR=$(printf "  Vendor: %-08s Model: %-16s Rev: %-4s" "$IVEND" "$IPROD" "$IPREV")
2073b1
   IPTYPE=$(echo "$INQ" | sed -n 's/.* Device_type=\([0-9]*\) .*/\1/p')
2073b1
+  if [ -z "$IPTYPE" ]; then
2073b1
+    IPTYPE=$(echo "$INQ" | sed -n 's/.* PDT=\([0-9]*\) .*/\1/p')
2073b1
+  fi
2073b1
   IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\)  Device.*/\1/p')
2073b1
+  if [ -z "$IPQUAL" ] ; then
2073b1
+    IPQUAL=$(echo "$INQ" | sed -n 's/ *PQual=\([0-9]*\)  PDT.*/\1/p')
2073b1
+  fi
2073b1
   if [ "$IPQUAL" != 0 ] ; then
2073b1
     [ -z "$IPQUAL" ] && IPQUAL=3
2073b1
     [ -z "$IPTYPE" ] && IPTYPE=31