1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-18 10:04:20 +03:00

fsadm: add -r to read

read without -r will mangle backslashes
This commit is contained in:
Zdenek Kabelac 2017-06-28 16:07:33 +02:00
parent afded3e532
commit c6a5964ce9

View File

@ -204,8 +204,8 @@ detect_fs() {
case "$RVOLUME" in case "$RVOLUME" in
# hardcoded /dev since udev does not create these entries elsewhere # hardcoded /dev since udev does not create these entries elsewhere
/dev/dm-[0-9]*) /dev/dm-[0-9]*)
read <"/sys/block/${RVOLUME#/dev/}/dm/name" SYSVOLUME 2>&1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME" read -r <"/sys/block/${RVOLUME#/dev/}/dm/name" SYSVOLUME 2>&1 && VOLUME="$DM_DEV_DIR/mapper/$SYSVOLUME"
read <"/sys/block/${RVOLUME#/dev/}/dev" MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"." read -r <"/sys/block/${RVOLUME#/dev/}/dev" MAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"."
MAJOR=${MAJORMINOR%%:*} MAJOR=${MAJORMINOR%%:*}
MINOR=${MAJORMINOR##*:} MINOR=${MAJORMINOR##*:}
;; ;;
@ -262,7 +262,7 @@ check_valid_mounted_device() {
case "$VOL" in case "$VOL" in
# hardcoded /dev since udev does not create these entries elsewhere # hardcoded /dev since udev does not create these entries elsewhere
/dev/dm-[0-9]*) /dev/dm-[0-9]*)
read <"/sys/block/${VOL#/dev/}/dev" MOUNTEDMAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"." read -r <"/sys/block/${VOL#/dev/}/dev" MOUNTEDMAJORMINOR 2>&1 || error "Cannot get major:minor for \"$VOLUME\"."
;; ;;
*) *)
STAT=$(stat --format "MOUNTEDMAJORMINOR=\$((0x%t)):\$((0x%T))" "$VOL") STAT=$(stat --format "MOUNTEDMAJORMINOR=\$((0x%t)):\$((0x%T))" "$VOL")