]> sourceware.org Git - lvm2.git/commitdiff
fsadm: split local var dev
authorZdenek Kabelac <zkabelac@redhat.com>
Wed, 28 Jun 2017 14:02:13 +0000 (16:02 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 29 Jun 2017 20:23:16 +0000 (22:23 +0200)
Split defining of local variables from being them
assigned at the same time (lossing error code).

scripts/fsadm.sh

index f3cc98bcfc3898563c6381688aa5f0b5aac8567e..b8744b1cf3a08d7b23435c1e0201ec0d11727c2c 100755 (executable)
@@ -229,8 +229,10 @@ detect_fs() {
 # Check that passed mounted MAJOR:MINOR is not matching $MAJOR:MINOR of resized $VOLUME
 validate_mounted_major_minor() {
        test "$1" = "$MAJORMINOR" || {
-               local REFNAME=$(dmsetup info -c -j "${1%%:*}" -m "${1##*:}" -o name --noheadings 2>/dev/null)
-               local CURNAME=$(dmsetup info -c -j "$MAJOR" -m "$MINOR" -o name --noheadings 2>/dev/null)
+               local REFNAME
+               local CURNAME
+               REFNAME=$(dmsetup info -c -j "${1%%:*}" -m "${1##*:}" -o name --noheadings 2>/dev/null)
+               CURNAME=$(dmsetup info -c -j "$MAJOR" -m "$MINOR" -o name --noheadings 2>/dev/null)
                error "Cannot ${CHECK+CHECK}${RESIZE+RESIZE} device \"$VOLUME\" without umounting filesystem $MOUNTED first." \
                      "Mounted filesystem is using device $CURNAME, but referenced device is $REFNAME." \
                      "Filesystem utilities currently do not support renamed devices."
@@ -243,10 +245,12 @@ validate_mounted_major_minor() {
 # abort further command processing
 check_valid_mounted_device() {
        local MOUNTEDMAJORMINOR
-       local VOL=$("$READLINK" $READLINK_E "$1")
-       local CURNAME=$(dmsetup info -c -j "$MAJOR" -m "$MINOR" -o name --noheadings)
+       local VOL
+       local CURNAME
        local SUGGEST="Possibly device \"$1\" has been renamed to \"$CURNAME\"?"
 
+       VOL=$("$READLINK" $READLINK_E "$1")
+       CURNAME=$(dmsetup info -c -j "$MAJOR" -m "$MINOR" -o name --noheadings)
        # more confused, device is not DM....
        test -n "$CURNAME" || SUGGEST="Mounted volume is not a device mapper device???"
 
This page took 0.039125 seconds and 5 git commands to generate.