summaryrefslogtreecommitdiff
path: root/src/core/libs/lib-blockdevices-filesystems.sh
diff options
context:
space:
mode:
authorDieter Plaetinck <dieter@plaetinck.be>2010-12-13 13:36:08 +0100
committerDieter Plaetinck <dieter@plaetinck.be>2010-12-13 13:36:08 +0100
commit8823aaa20db357cf3e1ebc50a0b43254a8090868 (patch)
tree4bff9711d7e155be211df9cdeaba79e676bda02f /src/core/libs/lib-blockdevices-filesystems.sh
parentd5fe860ebf0609bcd126c7fdf5da0637c3843438 (diff)
make sure get_blockdevice_size returns 0 if there was no issue, this caused some sizes not be shown
Diffstat (limited to 'src/core/libs/lib-blockdevices-filesystems.sh')
-rw-r--r--src/core/libs/lib-blockdevices-filesystems.sh2
1 files changed, 2 insertions, 0 deletions
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
}