diff --git a/testcurl.sh b/testcurl.sh
index a5ecd1775d192d46bc8cb5b4ff52e0ef14119deb..32c10b89dc10a898ac59ac77c04a67937f85c07c 100755
--- a/testcurl.sh
+++ b/testcurl.sh
@@ -71,11 +71,13 @@ else
   die
 fi
 
+build="build-$$"
+
 # remove any previous left-overs
-rm -rf build
+rm -rf $build
 
 # create a dir to build in
-mkdir build
+mkdir $build
 
 # get in the curl source tree root
 cd curl
@@ -99,7 +101,7 @@ else
 fi
 
 # change to build dir
-cd ../build
+cd "../$build"
 
 # run configure script
 ../curl/configure $1 2>&1
@@ -134,6 +136,6 @@ fi
 cd ..
 
 # delete build dir
-rm -rf build
+rm -rf "$build"
 
 die