Blob Blame History Raw
 scripts/fsadm.sh | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/scripts/fsadm.sh b/scripts/fsadm.sh
index c59d7b6..24b0e36 100755
--- a/scripts/fsadm.sh
+++ b/scripts/fsadm.sh
@@ -377,14 +377,11 @@ detect_mounted() {
 # get the full size of device in bytes
 detect_device_size() {
 	# check if blockdev supports getsize64
-	"$BLOCKDEV" --help 2>&1 | "$GREP" getsize64 >"$NULL"
-	if test $? -eq 0; then
-		DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME")
+	DEVSIZE=$("$BLOCKDEV" --getsize64 "$VOLUME" 2>"$NULL" || true)
+	if test -n "$DEVSIZE" ; then
+		DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME" || true)
 		test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
-	else
-		DEVSIZE=$("$BLOCKDEV" --getsize "$VOLUME")
-		test -n "$DEVSIZE" || error "Cannot read size of device \"$VOLUME\"."
-		SSSIZE=$("$BLOCKDEV" --getss "$VOLUME")
+		SSSIZE=$("$BLOCKDEV" --getss "$VOLUME" || true)
 		test -n "$SSSIZE" || error "Cannot read sector size of device \"$VOLUME\"."
 		DEVSIZE=$(("$DEVSIZE" * "$SSSIZE"))
 	fi