Index: llvm.svn.test/lib/Support/Unix/Path.inc
===================================================================
--- llvm.svn.test.orig/lib/Support/Unix/Path.inc	2012-03-25 21:25:14.000000000 +0200
+++ llvm.svn.test/lib/Support/Unix/Path.inc	2012-03-26 09:38:16.000000000 +0200
@@ -60,6 +60,10 @@
 #include <mach-o/dyld.h>
 #endif
 
+#if HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
 // Put in a hack for Cygwin which falsely reports that the mkdtemp function
 // is available when it is not.
 #ifdef __CYGWIN__
@@ -717,9 +721,18 @@
   }
 
   if (remove_contents) {
+    int rv;
     // Recursively descend the directory to remove its contents.
-    std::string cmd = "/bin/rm -rf " + path;
-    if (system(cmd.c_str()) != 0) {
+    switch (fork()) {
+    case -1:
+      return MakeErrMsg(ErrStr, path + ": failed to fork (recursively removing drectory).");
+    case 0:
+      execl("/bin/rm", "/bin/rm", "-rf", "--", path.c_str(), (char *) 0);
+      exit(1);
+    default:
+      wait(&rv);
+    }
+    if (rv != 0) {
       MakeErrMsg(ErrStr, path + ": failed to recursively remove directory.");
       return true;
     }
