summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-03-11 14:39:14 -0800
committerJeremy Allison <jra@samba.org>2010-03-11 14:41:01 -0800
commit1a10a5949d9f2148bdcd61a864104e5c305f8a59 (patch)
tree713a93ffa544815fbd992496696c227e2cf1261f
parent98ba174fa2bd174de58b9c97ba16627ff77374e8 (diff)
downloadsamba-1a10a5949d9f2148bdcd61a864104e5c305f8a59.tar.gz
samba-1a10a5949d9f2148bdcd61a864104e5c305f8a59.tar.bz2
samba-1a10a5949d9f2148bdcd61a864104e5c305f8a59.zip
Improve symlink delete test. Make sure we don't delete the link target by mistake.
Jeremy.
-rwxr-xr-xsource3/script/tests/test_smbclient_s3.sh26
1 files changed, 19 insertions, 7 deletions
diff --git a/source3/script/tests/test_smbclient_s3.sh b/source3/script/tests/test_smbclient_s3.sh
index 7896b2821f..dc9853d690 100755
--- a/source3/script/tests/test_smbclient_s3.sh
+++ b/source3/script/tests/test_smbclient_s3.sh
@@ -132,11 +132,13 @@ EOF
test_good_symlink()
{
tmpfile=/tmp/smbclient.in.$$
+ slink_name="$LOCAL_PATH/slink"
+ slink_target="$LOCAL_PATH/slink_target"
- touch "$LOCAL_PATH/foo"
- ln -s "$LOCAL_PATH/foo" "$LOCAL_PATH/bar"
+ touch $slink_target
+ ln -s $slink_target $slink_name
cat > $tmpfile <<EOF
-del bar
+del slink
quit
EOF
@@ -149,18 +151,28 @@ EOF
if [ $ret != 0 ] ; then
echo "$out"
echo "failed delete good symlink with error $ret"
+ rm $slink_target
+ rm $slink_name
false
return
fi
- if [ -e "$LOCAL_PATH/bar" ] ; then
+ if [ ! -e $slink_target ] ; then
+ echo "failed delete good symlink - symlink target deleted !"
+ rm $slink_target
+ rm $slink_name
+ false
+ return
+ fi
+
+ if [ -e $slink_name ] ; then
echo "failed delete good symlink - symlink still exists"
- rm "$LOCAL_PATH/bar"
- rm "$LOCAL_PATH/foo"
+ rm $slink_target
+ rm $slink_name
false
else
# got the correct prompt .. succeed
- rm "$LOCAL_PATH/foo"
+ rm $slink_target
true
fi
}