File 0006-rescan-scsi-bus.sh-Correctly-quote-MULTIPATH.patch of Package sg3_utils.1568

From 72d390d74f1ace7ba8c5f109b9d465ff6781ec02 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Wed, 25 Nov 2015 11:27:52 +0100
Subject: rescan-scsi-bus.sh: Correctly quote $MULTIPATH

The MULTIPATH variable might be empty, so we need to quote it
to avoid syntax errors.

References: bsc#955222

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 scripts/rescan-scsi-bus.sh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 36e2f09..ae677ef 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -853,7 +853,7 @@ findmultipath()
   local found_dup=0
 
   # Need a sdev, and executable multipath and dmsetup command here
-  if [ -z "$dev" ] || [ ! -x $DMSETUP ] || [ ! -x $MULTIPATH ] ; then
+  if [ -z "$dev" ] || [ ! -x $DMSETUP ] || [ ! -x "$MULTIPATH" ] ; then
     return 1
   fi
 
@@ -890,7 +890,7 @@ findmultipath()
 reloadmpaths()
 {
   local mpath
-  if [ ! -x $MULTIPATH ] ; then
+  if [ ! -x "$MULTIPATH" ] ; then
     echo "no -x multipath"
     return
   fi
@@ -1186,7 +1186,7 @@ declare -i updated=0
 declare -i rmvd=0
 
 if [ -n "$flush" ] ; then
-  if [-x $MULTIPATH ] ; then
+  if [-x "$MULTIPATH" ] ; then
     flushmpaths 1
   fi
 fi
@@ -1255,8 +1255,10 @@ if test -n "$mp_enable" -a $rmvd_found -gt 0 ; then
   if test $found -gt 0 ; then
     /sbin/udevadm trigger --sysname-match=sd*
     udevadm_settle
-    echo "Trying to discover new multipath mappings for newly discovered devices... "
-    $MULTIPATH | grep "create:" 2> /dev/null
+    if [ -x "$MULTIPATH" ] ; then
+      echo "Trying to discover new multipath mappings for newly discovered devices... "
+      $MULTIPATH | grep "create:" 2> /dev/null
+    fi
   fi 
 fi
 
-- 
1.8.4.5

openSUSE Build Service is sponsored by