aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System/Unix
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2006-08-07 05:20:05 +0000
committerReid Spencer <rspencer@reidspencer.com>2006-08-07 05:20:05 +0000
commitbffdc36c3820100e806520d0c5608a7752324d4b (patch)
tree26fd0f887d061971f6d38d6c3bd2ba63192fadf3 /lib/System/Unix
parente8501eb1bbb26a06c32682a396365e92a4449dd0 (diff)
downloadexternal_llvm-bffdc36c3820100e806520d0c5608a7752324d4b.zip
external_llvm-bffdc36c3820100e806520d0c5608a7752324d4b.tar.gz
external_llvm-bffdc36c3820100e806520d0c5608a7752324d4b.tar.bz2
Add a note about how the "isFile" check in Path::eraseFromDisk prevents
the erasure of non-file paths like /dev/null. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@29539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
-rw-r--r--lib/System/Unix/Path.inc5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index 83885c3..f79b2b2 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -569,6 +569,11 @@ Path::eraseFromDisk(bool remove_contents, std::string *ErrStr) const {
if (getFileStatus(Status, ErrStr))
return true;
+ // Note: this check catches strange situations. In all cases, LLVM should only
+ // be involved in the creation and deletion of regular files. This check
+ // ensures that what we're trying to erase is a regular file. It effectively
+ // prevents LLVM from erasing things like /dev/null, any block special file,
+ // or other things that aren't "regular" files.
if (Status.isFile) {
if (unlink(path.c_str()) != 0)
return GetErrno(path + ": can't destroy file", ErrStr);