1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-16 22:50:10 +03:00

Avoid using the find command to check if new image files are safe, for better performance

This commit is contained in:
Carlos Martín 2011-11-07 18:26:53 +01:00
parent 624fe79a9f
commit 38b2718c87

View File

@ -67,15 +67,19 @@ function fs_du {
}
function check_restricted {
if [ -n "`find -L $SAFE_DIRS -path $1 2>/dev/null`" ] ; then
echo 0
return
fi
for path in $SAFE_DIRS ; do
if [ -n "`readlink -f $1 | grep -E "^$path"`" ] ; then
echo 0
return
fi
done
if [ -n "`find -L $RESTRICTED_DIRS -path $1 2>/dev/null`" ]; then
echo 1
return
fi
for path in $RESTRICTED_DIRS ; do
if [ -n "`readlink -f $1 | grep -E "^$path"`" ] ; then
echo 1
return
fi
done
echo 0
}