Skip to content

Commit

Permalink
zfs-functions.in: in_mtab() always returns 1
Browse files Browse the repository at this point in the history
$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
  • Loading branch information
fling- authored and behlendorf committed Aug 20, 2019
1 parent 325d288 commit c759b33
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions etc/init.d/zfs-functions.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$?"
}
Expand Down

0 comments on commit c759b33

Please sign in to comment.