From 8823aaa20db357cf3e1ebc50a0b43254a8090868 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Mon, 13 Dec 2010 13:36:08 +0100 Subject: make sure get_blockdevice_size returns 0 if there was no issue, this caused some sizes not be shown --- src/core/libs/lib-blockdevices-filesystems.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core') diff --git a/src/core/libs/lib-blockdevices-filesystems.sh b/src/core/libs/lib-blockdevices-filesystems.sh index 41db8e4..f688789 100644 --- a/src/core/libs/lib-blockdevices-filesystems.sh +++ b/src/core/libs/lib-blockdevices-filesystems.sh @@ -892,6 +892,7 @@ get_blockdevice_size () # BLOCKDEVICE_SIZE=$(($blocks/1024)) bytes=$((`fdisk -l $1 2>/dev/null | sed -n '2p' | cut -d' ' -f5`)) + [[ $bytes = *[^0-9]* ]] && die_error "Could not parse fdisk -l output for $1" [ $unit = B ] && BLOCKDEVICE_SIZE=$bytes [ $unit = KiB ] && BLOCKDEVICE_SIZE=$((bytes/2**10)) # /1024 [ $unit = kB ] && BLOCKDEVICE_SIZE=$((bytes/10**3)) # /1000 @@ -899,6 +900,7 @@ get_blockdevice_size () [ $unit = MB ] && BLOCKDEVICE_SIZE=$((bytes/10**6)) [ $unit = GiB ] && BLOCKDEVICE_SIZE=$((bytes/2**30)) [ $unit = GB ] && BLOCKDEVICE_SIZE=$((bytes/10**9)) + true } -- cgit v1.2.3-54-g00ecf