]> git.proxmox.com Git - mirror_zfs.git/commitdiff
zfs-functions.in: in_mtab() always returns 1
authorAlexey Smirnoff <fling-@users.noreply.github.com>
Tue, 20 Aug 2019 23:26:19 +0000 (23:26 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 20 Aug 2019 23:26:19 +0000 (16:26 -0700)
$fs used with the wrong sed command where should be $mntpnt instead
to match a variable exported by read_mtab()

The fix is mostly to reuse the sed command found in read_mtab()

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Signed-off-by: Alexey Smirnoff <fling@member.fsf.org>
Closes #9168

etc/init.d/zfs-functions.in

index 490503e9139100e679d66a6705a999ecfd344b9b..14667b4e9fd315169ecba0a9c10f6b3e9e54e22f 100644 (file)
@@ -373,10 +373,13 @@ read_mtab()
 
 in_mtab()
 {
-       local fs="$(echo "$1" | sed 's,/,_,g')"
+       local mntpnt="$1"
+       # Remove 'unwanted' characters.
+       mntpnt=$(printf '%b\n' "$mntpnt" | sed -e 's,/,,g' \
+           -e 's,-,,g' -e 's,\.,,g' -e 's, ,,g')   
        local var
 
-       var="$(eval echo MTAB_$fs)"
+       var="$(eval echo MTAB_$mntpnt)"
        [ "$(eval echo "$""$var")" != "" ]
        return "$?"
 }