From: Eric Sandeen Date: Tue, 17 Sep 2013 19:30:41 +0000 (+0000) Subject: xfstests: check for valid input to _scratch_mkfs_sized X-Git-Tag: v2022.05.01~3364 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=969ed71b7073975ce4113e0f75d42e67c88cfcf9;p=xfstests-dev.git xfstests: check for valid input to _scratch_mkfs_sized _scratch_mkfs_sized requires an integer number of bytes as input; if it's given something else, catch it and _notrun. Signed-off-by: Eric Sandeen Reviewed-by: Mark Tinguely Signed-off-by: Rich Johnston --- diff --git a/common/rc b/common/rc index 4f708735..b2539487 100644 --- a/common/rc +++ b/common/rc @@ -569,6 +569,15 @@ _scratch_mkfs_sized() fssize=$1 blocksize=$2 [ -z "$blocksize" ] && blocksize=4096 + + re='^[0-9]+$' + if ! [[ $fssize =~ $re ]] ; then + _notrun "error: _scratch_mkfs_sized: fs size \"$fssize\" not an integer." + fi + if ! [[ $blocksize =~ $re ]] ; then + _notrun "error: _scratch_mkfs_sized: block size \"$blocksize\" not an integer." + fi + blocks=`expr $fssize / $blocksize` if [ "$HOSTOS" == "Linux" ]; then