changeset 450:ccd6c36da449

Change return values from _get_jail_from_path(): swap values for "dying" and "not found"
author Franz Glasner <fzglas.hg@dom66.de>
date Thu, 09 May 2024 09:02:34 +0200
parents 6127213b2c8f
children e7eba671bd74
files sbin/ftjail share/local-bsdtools/common.subr
diffstat 2 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/sbin/ftjail	Thu May 09 09:01:32 2024 +0200
+++ b/sbin/ftjail	Thu May 09 09:02:34 2024 +0200
@@ -945,7 +945,7 @@
     _jailname=$(_get_jail_from_path "${_directory}")
     _res=$?
     set -e
-    if [ ${_res} -ne 2 ] ; then
+    if [ ${_res} -ne 3 ] ; then
         if [ ${_res} -ne 0 ] ; then
             return ${_res}
         else
--- a/share/local-bsdtools/common.subr	Thu May 09 09:01:32 2024 +0200
+++ b/share/local-bsdtools/common.subr	Thu May 09 09:02:34 2024 +0200
@@ -157,8 +157,8 @@
 #: Return:
 #:   0: if a running jail is found
 #:   1: error
-#:   2: no running jail found
-#:   3: jail found but currently dying
+#:   2: jail found but currently dying
+#:   3: no running jail found
 #:
 _get_jail_from_path() {
   local _location
@@ -175,12 +175,12 @@
         if [ "${_path}" = "${_location}" ]; then
           if [ "${_dying}" != "false" ]; then
             echo "Jail \`${_name}' is currently dying" 1>&2
-            return 3
+            return 2
           fi
           echo "${_name}"
           return 0
         fi
       done
-      return 2
+      return 3
   }
 }