Blame SOURCES/0001-Fix-dev-null-redirect-mistakes.patch

50bc9c
From 9d2adc90e76e76c07ee63b2b2868579188fec1a7 Mon Sep 17 00:00:00 2001
50bc9c
From: David Sommerseth <davids@redhat.com>
50bc9c
Date: Fri, 15 Apr 2016 23:53:18 +0200
50bc9c
Subject: [PATCH] Fix /dev/null redirect mistakes
50bc9c
50bc9c
Several places there are attempts to redirect to /dev/null, but
50bc9c
missing the redirect operator.  This causes also /dev/null to be
50bc9c
deleted when running 'rescan-scsi-bus.sh -u'.
50bc9c
50bc9c
Patch based on proposed patches in Red Hat bugzilla 1245302
50bc9c
---
50bc9c
 scripts/rescan-scsi-bus.sh | 28 ++++++++++++++--------------
50bc9c
 1 file changed, 14 insertions(+), 14 deletions(-)
50bc9c
2d6102
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
2d6102
index 7ec9323..4468cd3 100644
2d6102
--- a/scripts/rescan-scsi-bus.sh
2d6102
+++ b/scripts/rescan-scsi-bus.sh
2d6102
@@ -234,7 +234,7 @@ testonline ()
50bc9c
   if test ! -x /usr/bin/sg_turs; then return 0; fi
50bc9c
   sgdevice
50bc9c
   if test -z "$SGDEV"; then return 0; fi
50bc9c
-  sg_turs /dev/$SGDEV >/dev/null 2>&1
50bc9c
+  sg_turs /dev/$SGDEV &>/dev/null
50bc9c
   RC=$?
2d6102
   # Handle in progress of becoming ready and unit attention -- wait at max 11s
2d6102
   declare -i ctr=0
2d6102
@@ -246,7 +246,7 @@ testonline ()
50bc9c
     if test $RC = 2 -a "$RMB" != "1"; then echo -n "."; let LN+=1; sleep 1
2d6102
     else usleep 20000; fi
50bc9c
     let ctr+=1
50bc9c
-    sg_turs /dev/$SGDEV >/dev/null 2>&1
50bc9c
+    sg_turs /dev/$SGDEV &>/dev/null
50bc9c
     RC=$?
2d6102
   done
2d6102
   if test $ctr != 0; then white_out; fi
2d6102
@@ -703,7 +703,7 @@ findremapped()
50bc9c
   # Trigger udev to update the info
50bc9c
   echo -n "Triggering udev to update device information... "
50bc9c
   /sbin/udevadm trigger
2d6102
-  udevadm_settle 2&>1 /dev/null
50bc9c
+  udevadm_settle &>/dev/null
50bc9c
   echo "Done"
50bc9c
 
50bc9c
   # See what changed and reload the respective multipath device if applicable
2d6102
@@ -724,12 +724,12 @@ findremapped()
2d6102
       incrchgd "$hctl"
2d6102
     fi
2d6102
   done < $tmpfile
2d6102
-  rm $tmpfile 2&>1 /dev/null
2d6102
+  rm $tmpfile &>/dev/null
2d6102
 
2d6102
   if test -n "$mp_enable" -a -n "$mpaths" ; then
2d6102
     echo "Updating multipath device mappings"
2d6102
     flushmpaths
2d6102
-    $MULTIPATH | grep "create:" 2> /dev/null #2&>1 /dev/null
2d6102
+    $MULTIPATH | grep "create:" 2> /dev/null
2d6102
   fi
2d6102
 }
2d6102
 
2d6102
@@ -831,14 +831,14 @@ reloadmpaths()
2d6102
 
50bc9c
   if [ "$1" = "1" ] ; then
50bc9c
     echo "Reloading all multipath devices"
2d6102
-    $MULTIPATH -r 2&>1 /dev/null
50bc9c
+    $MULTIPATH -r &>/dev/null
50bc9c
     return
50bc9c
   fi
50bc9c
 
50bc9c
   # Reload the multipath devices
50bc9c
   for mpath in $mpaths ; do
2d6102
     echo "Reloading multipath device $mpath"
2d6102
-    $MULTIPATH -r $mpath 2&>1 /dev/null
50bc9c
+    $MULTIPATH -r $mpath &>/dev/null
2d6102
   done
2d6102
 }
2d6102
 
2d6102
@@ -851,9 +851,9 @@ flushmpaths()
2d6102
       num=$($DMSETUP status $mpath | awk 'BEGIN{RS=" ";active=0}/[0-9]+:[0-9]+/{dev=1}/A/{if (dev == 1) active++; dev=0} END{ print active }')
2d6102
       if [ $num -eq 0 ] ; then
2d6102
         echo -n "Flushing multipath device $mpath...  "
2d6102
-        $DMSETUP message $mpath 0 fail_if_no_path 2&>1 /dev/null
2d6102
-        $MULTIPATH -f $mpath 2&>1 /dev/null
2d6102
-        $DMSETUP status $mpath 2&>1 /dev/null
2d6102
+        $DMSETUP message $mpath 0 fail_if_no_path &>/dev/null
2d6102
+        $MULTIPATH -f $mpath &>/dev/null
2d6102
+        $DMSETUP status $mpath &>/dev/null
2d6102
         if test "$?" = "1" ; then
2d6102
           echo "Done"
2d6102
         else
2d6102
@@ -866,9 +866,9 @@ flushmpaths()
2d6102
   # Flush all the devs specified in $mpaths
2d6102
   for mpath in $mpaths ; do
2d6102
     echo -n "Flushing multipath device $mpath...  "
2d6102
-    $DMSETUP message $mpath 0 fail_if_no_path 2&>1 /dev/null
2d6102
-    $MULTIPATH -f $mpath 2&>1 /dev/null
2d6102
-    $DMSETUP status $mpath 2&>1 /dev/null
2d6102
+    $DMSETUP message $mpath 0 fail_if_no_path &>/dev/null
2d6102
+    $MULTIPATH -f $mpath &>/dev/null
2d6102
+    $DMSETUP status $mpath &>/dev/null
2d6102
     if test "$?" = "1" ; then
50bc9c
       echo "Done"
50bc9c
     else
2d6102
@@ -967,7 +967,7 @@ if test ! -d /sys/class/scsi_host/ -a ! -d /proc/scsi/; then
2d6102
 fi	
50bc9c
 
50bc9c
 # Make sure sg is there
50bc9c
-modprobe sg >/dev/null 2>&1
50bc9c
+modprobe sg &>/dev/null
50bc9c
 
50bc9c
 if test -x /usr/bin/sg_inq; then
50bc9c
   sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3)
2d6102
-- 
2d6102
1.8.3.1
2d6102