From 9d2adc90e76e76c07ee63b2b2868579188fec1a7 Mon Sep 17 00:00:00 2001 From: David Sommerseth Date: Fri, 15 Apr 2016 23:53:18 +0200 Subject: [PATCH] Fix /dev/null redirect mistakes Several places there are attempts to redirect to /dev/null, but missing the redirect operator. This causes also /dev/null to be deleted when running 'rescan-scsi-bus.sh -u'. Patch based on proposed patches in Red Hat bugzilla 1245302 --- scripts/rescan-scsi-bus.sh | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff -up sg3_utils-1.44/scripts/rescan-scsi-bus.sh.bak sg3_utils-1.44/scripts/rescan-scsi-bus.sh --- sg3_utils-1.44/scripts/rescan-scsi-bus.sh.bak 2019-08-15 14:50:03.214163924 +0200 +++ sg3_utils-1.44/scripts/rescan-scsi-bus.sh 2019-08-15 15:46:37.110566516 +0200 @@ -261,7 +261,7 @@ testonline () if test ! -x /usr/bin/sg_turs; then return 0; fi sgdevice if test -z "$SGDEV"; then return 0; fi - sg_turs /dev/$SGDEV >/dev/null 2>&1 + sg_turs /dev/$SGDEV &>/dev/null RC=$? # Handle in progress of becoming ready and unit attention @@ -269,7 +269,7 @@ testonline () if test $RC = 2 -a "$RMB" != "1"; then echo -n "."; let LN+=1; sleep 1 else sleep 0.02; fi let ctr+=1 - sg_turs /dev/$SGDEV >/dev/null 2>&1 + sg_turs /dev/$SGDEV &>/dev/null RC=$? # Check for removable device; TEST UNIT READY obviously will # fail for a removable device with no medium @@ -775,7 +775,7 @@ findremapped() # Trigger udev to update the info echo -n "Triggering udev to update device information... " /sbin/udevadm trigger - udevadm_settle 2>&1 /dev/null + udevadm_settle &>/dev/null echo "Done" # See what changed and reload the respective multipath device if applicable @@ -954,14 +954,14 @@ reloadmpaths() # Pass 1 as the argument to reload all mpaths if [ "$1" = "1" ] ; then echo "Reloading all multipath devices" - $MULTIPATH -r > /dev/null 2>&1 + $MULTIPATH -r &>/dev/null return fi # Reload the multipath devices for mpath in $mpaths ; do echo -n "Reloading multipath device $mpath... " - $MULTIPATH -r $mpath > /dev/null 2>&1 + $MULTIPATH -r $mpath &>/dev/null if test "$?" = "0" ; then echo "Done" else @@ -1004,8 +1004,8 @@ flushmpaths() i=0 echo -n "Flushing multipath device $mpath... " while [ $i -lt $flush_retries ] ; do - $DMSETUP message $mpath 0 fail_if_no_path > /dev/null 2>&1 - $MULTIPATH -f $mpath > /dev/null 2>&1 + $DMSETUP message $mpath 0 fail_if_no_path &>/dev/null + $MULTIPATH -f $mpath &>/dev/null if test "$?" = "0" ; then echo "Done ($i retries)" break @@ -1146,7 +1146,7 @@ if test ! -d /sys/class/scsi_host/ -a ! fi # Make sure sg is there -modprobe sg >/dev/null 2>&1 +modprobe sg &>/dev/null if test -x /usr/bin/sg_inq; then sg_version=$(sg_inq -V 2>&1 | cut -d " " -f 3)