[PATCH 01/15] 95iscsi: parse output from iscsiadm correctly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Hannes Reinecke <hare@xxxxxxx>

Due to some obsure reason the IFS parameter is not set correctly
when evaluating get_ibft_mod(). So change the parsing to not rely
on IFS altogether.

References: bnc#886199

Signed-off-by: Hannes Reinecke <hare@xxxxxxx>
Signed-off-by: Thomas Renninger <trenn@xxxxxxx>
---
 modules.d/95iscsi/module-setup.sh | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/modules.d/95iscsi/module-setup.sh b/modules.d/95iscsi/module-setup.sh
index 9975e59..f13119f 100755
--- a/modules.d/95iscsi/module-setup.sh
+++ b/modules.d/95iscsi/module-setup.sh
@@ -30,15 +30,16 @@ check() {
 
 get_ibft_mod() {
     local ibft_mac=$1
+    local iface_mac iface_mod
     # Return the iSCSI offload module for a given MAC address
-    iscsiadm -m iface | while read iface_name iface_desc ; do
-        IFS=$','
-        set -- $iface_desc
-        if [ "$ibft_mac" = "$2" ] ; then
-            echo $1
+    for iface_desc in $(iscsiadm -m iface | cut -f 2 -d ' '); do
+        iface_mod=${iface_desc%%,*}
+        iface_mac=${iface_desc#*,}
+        iface_mac=${iface_mac%%,*}
+        if [ "$ibft_mac" = "$iface_mac" ] ; then
+            echo $iface_mod
             return 0
         fi
-        unset IFS
     done
 }
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux