From: Alexey Smirnoff Date: Tue, 20 Aug 2019 23:26:19 +0000 (+0000) Subject: zfs-functions.in: in_mtab() always returns 1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c759b33a519ca5f0d5bce51501bd4230134d4b25;p=zfs 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 Reviewed-by: Michael Niewöhner Signed-off-by: Alexey Smirnoff Closes #9168 --- diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in index 490503e91..14667b4e9 100644 --- a/etc/init.d/zfs-functions.in +++ b/etc/init.d/zfs-functions.in @@ -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 "$?" }