Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
changeset 650:5a367d44b480
ftjail: Refactor the result checks for _get_jail_from_path
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Fri, 27 Sep 2024 21:23:19 +0200 |
| parents | 4ee9a8042f4a |
| children | 57ee25cec0dd |
| files | sbin/ftjail |
| diffstat | 1 files changed, 17 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/sbin/ftjail Fri Sep 27 21:21:34 2024 +0200 +++ b/sbin/ftjail Fri Sep 27 21:23:19 2024 +0200 @@ -911,17 +911,26 @@ _dir_basename="$(basename "${_directory}")" set +e - _jailname=$(_get_jail_from_path "${_directory}") + _jailname="$(_get_jail_from_path "${_directory}")" _res=$? set -e - if [ ${_res} -ne 3 ] ; then - if [ ${_res} -ne 0 ] ; then + case ${_res} in + 0) + err "Please stop the \`${_jailname}' jail" + return 1 + ;; + 2) + err "Jail \`${_jailname}' is currently yet dying" + return 1 + ;; + 3) + true + ;; + *) return ${_res} - else - echo "ERROR: Please stop the \`${_jailname}' jail" >&2 - return 1 - fi - fi + ;; + esac + # # Check whether additional log sockets are opened at their default # locations. Because they hinder proper unmounting of filesystems.
