# HG changeset patch # User Franz Glasner # Date 1661076539 -7200 # Node ID 6b7a084ddf1d0baca3f8d8906eb857508fcc238f # Parent 687210f46b8f10b0e31f08ff80e4d890e692c16b Replace all calls to "zfs get" to "zfs list -o". This is to get rid of some "read" calls. diff -r 687210f46b8f -r 6b7a084ddf1d sbin/fjail --- a/sbin/fjail Sun Aug 21 11:43:01 2022 +0200 +++ b/sbin/fjail Sun Aug 21 12:08:59 2022 +0200 @@ -135,7 +135,7 @@ # parent ZFS dataset -- child ZFS dataset name local _pds _cds # and its mount point - local _pmp _get _dummy + local _pmp _get # full name of the dataset local _ds # dynamic ZFS options -- create cache for freebsd-update -- use a more tiny layout @@ -174,10 +174,7 @@ echo "ERROR: no parent dataset given" >&2 return 2 fi - _get=$(zfs get -H mountpoint "${_pds}" 2>/dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } - IFS=$'\t' read _dummy _dummy _pmp _dummy </dev/null) || { echo "ERROR: dataset \`${_pds}' does not exist" >&2; return 1; } case "${_pmp}" in none) echo "ERROR: dataset \`${_pds}' has no mountpoint" >&2 @@ -198,7 +195,7 @@ fi _ds="${_pds}/${_cds}" echo "Resulting new root dataset is \`${_ds}' at mountpoint \`${_pmp}/${_cds}'" - if zfs get -H mountpoint "${_ds}" >/dev/null 2>/dev/null; then + if zfs list -H -o mountpoint "${_ds}" >/dev/null 2>/dev/null; then echo "ERROR: dataset \`${_ds}' does already exist" >&2 return 1 fi @@ -499,10 +496,7 @@ _vestatus="" _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 </dev/null) || { echo "ERROR: cannot determine readonly status of ${_mp}/var/empty" >&2; return 1; } if [ "${_vestatus}" = "on" ]; then zfs set readonly=off ${_veds} 1> /dev/null || { echo "ERROR: cannot reset readonly-status of ${_mp}/var/empty" >&2; return 1; } fi