aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Smirnoff <[email protected]>2019-08-20 23:26:19 +0000
committerBrian Behlendorf <[email protected]>2019-08-20 16:26:19 -0700
commitc759b33a519ca5f0d5bce51501bd4230134d4b25 (patch)
tree9c9b874cdd2bb407ca9982e9cb93a680e66cfbb0
parent325d288c5d536227010ff4dfcf66df89f123d166 (diff)
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 <[email protected]> Reviewed-by: Michael Niewöhner <[email protected]> Signed-off-by: Alexey Smirnoff <[email protected]> Closes #9168
-rw-r--r--etc/init.d/zfs-functions.in7
1 files changed, 5 insertions, 2 deletions
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 "$?"
}