Blame SOURCES/rescan-scsi-bus_sg_inq-parse.patch

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