public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfstests: check for valid input to _scratch_mkfs_sized
@ 2013-09-17 19:30 Eric Sandeen
  2013-09-17 20:41 ` Mark Tinguely
  2013-10-16 20:57 ` Rich Johnston
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Sandeen @ 2013-09-17 19:30 UTC (permalink / raw)
  To: xfs-oss

_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 <sandeen@redhat.com>
---

diff --git a/common/rc b/common/rc
index 77e96c4..6afc164 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


_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-16 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 19:30 [PATCH] xfstests: check for valid input to _scratch_mkfs_sized Eric Sandeen
2013-09-17 20:41 ` Mark Tinguely
2013-09-17 21:11   ` Eric Sandeen
2013-10-16 20:57 ` Rich Johnston

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox