diff sbin/fjail @ 196:a4fd3bcbbf1c

Use "mount -p" instead of "zfs mount" when determining devices for the real mountpoints
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 21 Aug 2022 10:27:14 +0200
parents 4a0cb73945a8
children 3181a6b5758e
line wrap: on
line diff
--- a/sbin/fjail	Sun Aug 21 08:50:20 2022 +0200
+++ b/sbin/fjail	Sun Aug 21 10:27:14 2022 +0200
@@ -83,21 +83,21 @@
 
 
 _get_dataset_for_mountpoint() {
-    : 'Use `zfs mount` to determine the ZFS dataset for a given mountpoint.
+    : 'Use `mount -t zfs -p` to determine the ZFS dataset for a given mountpoint.
 
     '
     local _mountpoint
-    local _ds _mount
+    local _ds _mount _rest
 
     _mountpoint="$1"
 
-    while read -r _ds _mount; do
+    while IFS=' '$'\t' read -r _ds _mount _rest ; do
         if [ "$_mount" = "$_mountpoint" ]; then
-            echo $_ds
+            echo "${_ds}"
             return 0
         fi
     done <<EOF__GDSFM
-$(zfs mount)
+$(mount -t zfs -p)
 EOF__GDSFM
     return 1
 }
@@ -492,7 +492,7 @@
     # make it writeable temporarily if it is mounted read-only:
     #
     _vestatus=""
-    _veds=$(_get_dataset_for_varempty "${_mp}")
+    _veds="$(_get_dataset_for_varempty "${_mp}")"
     if [ $? -eq 0 ]; then
         _get=$(zfs get -H readonly ${_veds} 2>/dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; }
         IFS=$'\t' read _dummy _dummy _vestatus _dummy <<EOF