diff sbin/fjail @ 197:3181a6b5758e

FIX: Using a pipeline within a function correctly with regard to return values: The last pipeline element determines the status. Account for this. So instead of a here-doc a pipeline can be used.
author Franz Glasner <fzglas.hg@dom66.de>
date Sun, 21 Aug 2022 10:49:00 +0200
parents a4fd3bcbbf1c
children dd8a9bbdf8c0
line wrap: on
line diff
--- a/sbin/fjail	Sun Aug 21 10:27:14 2022 +0200
+++ b/sbin/fjail	Sun Aug 21 10:49:00 2022 +0200
@@ -91,15 +91,16 @@
 
     _mountpoint="$1"
 
-    while IFS=' '$'\t' read -r _ds _mount _rest ; do
-        if [ "$_mount" = "$_mountpoint" ]; then
-            echo "${_ds}"
-            return 0
-        fi
-    done <<EOF__GDSFM
-$(mount -t zfs -p)
-EOF__GDSFM
-    return 1
+    mount -t zfs -p \
+    | {
+        while IFS=' '$'\t' read -r _ds _mount _rest ; do
+            if [ "$_mount" = "$_mountpoint" ]; then
+                echo "${_ds}"
+                return 0
+            fi
+        done
+        return 1
+    }
 }