From 312c276483c2277b93ddc79ce51b4b017521e5f1 Mon Sep 17 00:00:00 2001 From: erdgeist Date: Fri, 23 Mar 2007 16:08:43 +0000 Subject: Stale device link detection completed and tested. More testing required. --- ezjail-admin | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ezjail-admin') diff --git a/ezjail-admin b/ezjail-admin index aa7b16d..a4e50e1 100755 --- a/ezjail-admin +++ b/ezjail-admin @@ -120,7 +120,12 @@ fetchjailinfo () { if [ -n "${ezjail_image}" -a -L "${ezjail_rootdir}.device" ]; then # Fetch destination of soft link ezjail_device=`stat -f "%Y" ${ezjail_rootdir}.device` - [ -e "${ezjail_device}" ] && ezjail_attached="YES" + + mount -p -v | grep -q -E "^${ezjail_rootdir}.device.${ezjail_rootdir}" && ezjail_attached="YES" + mount -p -v | grep -q -E "^${ezjail_device}.${ezjail_rootdir}" && ezjail_attached="YES" + + # Stale device link detected. Remove and clean. + [ -z "${ezjail_attached}" ] && unset ezjail_device && rm -f ${ezjail_rootdir}.device fi [ -f /var/run/jail_${ezjail_safename}.id ] && ezjail_id=`cat /var/run/jail_${ezjail_safename}.id` || return -- cgit v1.2.3