zfs-functions.in: in_mtab() always returns 1

$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
This commit is contained in:
Alexey Smirnoff 2019-08-20 23:26:19 +00:00 committed by Brian Behlendorf
parent 325d288c5d
commit c759b33a51

View 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 "$?"
}