Permalink
Browse files

Fix a usage quirk with warden. Don't report jail as running just

because a mount-point is still left.

We will now check for that condition only before trying to delete a
jail
  • Loading branch information...
1 parent 65f39d9 commit 6d06bd191fe140361b5d4e3c396d1da5f4c4f3bf @kmoore134 kmoore134 committed Jun 17, 2014
Showing with 13 additions and 13 deletions.
  1. +2 −12 src-sh/warden/scripts/backend/checkstatus.sh
  2. +11 −1 src-sh/warden/scripts/backend/deletejail.sh
@@ -34,16 +34,6 @@ fi
# End of error checking, now see if the jail is active
#####################################################################
-# Check if anything is still mounted in this jail
-hasmount="0"
-for mountpoint in $(mount | grep -e "${JAILDIR}/" | cut -d" " -f3); do
- hasmount="1"
-done
-
# Check if the jail is active
-jls | grep "${JAILDIR}$" >/dev/null 2>/dev/null
-if [ "$?" = "0" -o "$hasmount" = "1" ]; then
- exit 0
-else
- exit 1
-fi
+jls | grep -q "${JAILDIR}$"
+exit $?
@@ -45,7 +45,17 @@ fi
# Confirm jail was shutdown and no mounts are left
${PROGDIR}/scripts/backend/checkstatus.sh "${JAILNAME}"
if [ "$?" = "0" ] ; then
- echo "ERROR: Jail is still running, or has active mount-points.. Please stop manually."
+ echo "ERROR: Jail is still running! Please stop manually."
+ exit 5
+fi
+
+# Check if anything is still mounted in this jail
+hasmount=0
+for mountpoint in $(mount | grep -e "${JAILDIR}/" | cut -d" " -f3); do
+ hasmount=1
+done
+if [ $hasmount -eq 1 ] ; then
+ echo "ERROR: Jail still has active mount points. Please unmount them manually."
exit 5
fi

0 comments on commit 6d06bd1

Please sign in to comment.