diff mbox

generic: Fix _is_block_dev quoting

Message ID 1431455799-13289-1-git-send-email-andreas.gruenbacher@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andreas Grünbacher May 12, 2015, 6:36 p.m. UTC
Add more quoting so that test cases that don't require a SCRATCH_DEV won't
fail.

Signed-off-by: Andreas Gruenbacher <andreas.gruenbacher@gmail.com>
---
 common/rc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
diff mbox

Patch

diff --git a/common/rc b/common/rc
index 6ea107e..bec7417 100644
--- a/common/rc
+++ b/common/rc
@@ -967,11 +967,11 @@  _is_block_dev()
 
     _dev=$1
     if [ -L "${_dev}" ]; then
-        _dev=`readlink -f ${_dev}`
+        _dev=`readlink -f "${_dev}"`
     fi
 
     if [ -b "${_dev}" ]; then
-        src/lstat64 ${_dev} | $AWK_PROG '/Device type:/ { print $9 }'
+        src/lstat64 "${_dev}" | $AWK_PROG '/Device type:/ { print $9 }'
     fi
 }
 
@@ -1105,11 +1105,11 @@  _require_scratch_nocheck()
 		fi
 		;;
 	*)
-		 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev $SCRATCH_DEV`" = "" ]
+		 if [ -z "$SCRATCH_DEV" -o "`_is_block_dev "$SCRATCH_DEV"`" = "" ]
 		 then
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
-		 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
+		 if [ "`_is_block_dev "$SCRATCH_DEV"`" = "`_is_block_dev "$TEST_DEV"`" ]
 		 then
 		     _notrun "this test requires a valid \$SCRATCH_DEV"
 		 fi
@@ -1179,11 +1179,11 @@  _require_test()
 		fi
 		;;
 	*)
-		 if [ -z "$TEST_DEV" -o "`_is_block_dev $TEST_DEV`" = "" ]
+		 if [ -z "$TEST_DEV" ] || [ "`_is_block_dev "$TEST_DEV"`" = "" ]
 		 then
 		     _notrun "this test requires a valid \$TEST_DEV"
 		 fi
-		 if [ "`_is_block_dev $SCRATCH_DEV`" = "`_is_block_dev $TEST_DEV`" ]
+		 if [ "`_is_block_dev "$SCRATCH_DEV"`" = "`_is_block_dev "$TEST_DEV"`" ]
 		 then
 		     _notrun "this test requires a valid \$TEST_DEV"
 		 fi
@@ -2282,10 +2282,10 @@  _require_scratch_dev_pool()
 	esac
 
 	for i in $SCRATCH_DEV_POOL; do
-		if [ "`_is_block_dev $i`" = "" ]; then
+		if [ "`_is_block_dev "$i"`" = "" ]; then
 			_notrun "this test requires valid block disk $i"
 		fi
-		if [ "`_is_block_dev $i`" = "`_is_block_dev $TEST_DEV`" ]; then
+		if [ "`_is_block_dev "$i"`" = "`_is_block_dev "$TEST_DEV"`" ]; then
 			_notrun "$i is part of TEST_DEV, this test requires unique disks"
 		fi
 		if _mount | grep -q $i; then