# Use the side effect of find(1).
fs_fix_unionfs_image_if_hidden ()
{
- local needlepath needlepath_cur
+ local needlepath needlepath_cur needlepath_next
needlepath=$1
needlepath_cur=$needlepath
while :
do
find -dx "$needlepath_cur" -maxdepth 0 > /dev/null 2>&1 || :
- needlepath_cur=`dirname "$needlepath_cur"`
+ needlepath_next=`dirname "$needlepath_cur"`
+ [ "x$needlepath_cur" = "x$needlepath_next" ] && break
+ needlepath_cur=$needlepath_next
done
[ -e "$needlepath" ] && return
message_echo "ERROR: Lost mandatory file, probably due to the bug of unionfs: $needlepath" >&2