/usr/src/llvm-2.9/patches/0008-path-eraseFromDisk.patch is in llvm-2.9-source 2.9+dfsg-3ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ---
Path.inc | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -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__
@@ -760,9 +764,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 directory).");
+ 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;
}
|