comparison sbin/ftjail @ 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 b0e8b5cf5d33
children 39a7594b45f9
comparison
equal deleted inserted replaced
649:4ee9a8042f4a 650:5a367d44b480
909 fi 909 fi
910 910
911 _dir_basename="$(basename "${_directory}")" 911 _dir_basename="$(basename "${_directory}")"
912 912
913 set +e 913 set +e
914 _jailname=$(_get_jail_from_path "${_directory}") 914 _jailname="$(_get_jail_from_path "${_directory}")"
915 _res=$? 915 _res=$?
916 set -e 916 set -e
917 if [ ${_res} -ne 3 ] ; then 917 case ${_res} in
918 if [ ${_res} -ne 0 ] ; then 918 0)
919 err "Please stop the \`${_jailname}' jail"
920 return 1
921 ;;
922 2)
923 err "Jail \`${_jailname}' is currently yet dying"
924 return 1
925 ;;
926 3)
927 true
928 ;;
929 *)
919 return ${_res} 930 return ${_res}
920 else 931 ;;
921 echo "ERROR: Please stop the \`${_jailname}' jail" >&2 932 esac
922 return 1 933
923 fi
924 fi
925 # 934 #
926 # Check whether additional log sockets are opened at their default 935 # Check whether additional log sockets are opened at their default
927 # locations. Because they hinder proper unmounting of filesystems. 936 # locations. Because they hinder proper unmounting of filesystems.
928 # 937 #
929 for _add_log_sock in /var/run/log /var/run/logpriv ; do 938 for _add_log_sock in /var/run/log /var/run/logpriv ; do