1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

fsadm: handle error from blkid

Fsadm wants to print its own error message when it can't detect
type of the filesystem on a block device.
Otherwise fsadm exits with no message on an unused block device.
This commit is contained in:
Zdenek Kabelac 2021-03-24 16:26:17 +01:00
parent 63c58d2a5d
commit 28865f971e

View File

@ -230,7 +230,7 @@ detect_fs() {
esac
# use null device as cache file to be sure about the result
# not using option '-o value' to be compatible with older version of blkid
FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME")
FSTYPE=$("$BLKID" -c "$NULL" -s TYPE "$VOLUME" || true)
test -n "$FSTYPE" || error "Cannot get FSTYPE of \"$VOLUME\"."
FSTYPE=${FSTYPE##*TYPE=\"} # cut quotation marks
FSTYPE=${FSTYPE%%\"*}