From dcaa460d6d5afd66f9e9d24c113bfe984c2b34c9 Mon Sep 17 00:00:00 2001 From: Alexey Smirnoff Date: Tue, 20 Aug 2019 23:26:19 +0000 Subject: [PATCH] zfs-functions.in: in_mtab() always returns 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit $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 --- etc/init.d/zfs-functions.in | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/etc/init.d/zfs-functions.in b/etc/init.d/zfs-functions.in index cbc7fd22a..d65c79dcf 100644 --- a/etc/init.d/zfs-functions.in +++ b/etc/init.d/zfs-functions.in @@ -366,10 +366,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 "$?" }